i am using handy controls and this is first time to use it so i am facing some difficulties
in test app i am using hc:SideMenu
and i can get out the selected item header from the hc:SideMenu
<hc:SideMenu
x:Name="MySideMenu"
Grid.Column="0"
Width="200"
Margin="5"
BorderThickness="1"
SelectionChanged="MySideMenu_SelectionChanged">
<hc:Interaction.Triggers>
<hc:EventTrigger EventName="SelectionChanged">
<hc:EventToCommand Command="{Binding SwitchItemCmd}" PassEventArgsToCommand="True" />
</hc:EventTrigger>
</hc:Interaction.Triggers>
<hc:SideMenuItem Header="Overview" IsSelected="True">
<hc:SideMenuItem.Icon>
<Image
Width="24"
Height="24"
Source="/Folder/01.png" />
</hc:SideMenuItem.Icon>
<hc:SideMenuItem
x:Name="MySummary"
Command="{Binding SelectCmd}"
CommandParameter="{Binding Header, RelativeSource={RelativeSource Self}}"
Header="Summary"
IsSelected="False">
<hc:SideMenuItem.Icon>
<TextBlock Text="" />
</hc:SideMenuItem.Icon>
</hc:SideMenuItem>
<hc:SideMenuItem
Command="{Binding SelectCmd}"
CommandParameter="{Binding Header, RelativeSource={RelativeSource Self}}"
Header="Dashboards">
<hc:SideMenuItem.Icon>
<TextBlock Text="" />
</hc:SideMenuItem.Icon>
</hc:SideMenuItem>
<hc:SideMenuItem
Command="{Binding SelectCmd}"
CommandParameter="{Binding Header, RelativeSource={RelativeSource Self}}"
Header="Wiki">
<hc:SideMenuItem.Icon>
<TextBlock Text="" />
</hc:SideMenuItem.Icon>
</hc:SideMenuItem>
</hc:SideMenuItem>
</hc:SideMenu>
and C# code is
private void MySideMenu_SelectionChanged(object sender, HandyControl.Data.FunctionEventArgs e) {
string SelectedItemHeader = ((HeaderedSimpleItemsControl)MySideMenu.Header).ToString();
textBox.Text = SelectedItemHeader;
}
Try this:
private void MySideMenu_SelectionChanged(object sender,
HandyControl.Data.FunctionEventArgs<object> e)
{
SideMenuItem sideMenuItem = e.Info as SideMenuItem;
textBox.Text = sideMenuItem?.Header?.ToString();
}