i have a ContextMenu on a Button in XAML. The ContextMenu Items are loaded by the ItemsSource property. Now I want to set the text of the button with the SelectedItem.Text of the ContextMenu. Is there any solution to do this?
Here is a snippet of my XAML code:
<Button Grid.Column="4" Grid.Row="1" Width="100" Height="24" BorderThickness="0" Command="{Binding SwitchFieldClickCommand}" Content="{}">
<Button.ContextMenu>
<ContextMenu Name="CM_SwitchField">
<ItemsControl ItemsSource="{Binding Benutzer.SwitchFieldList}" />
</ContextMenu>
</Button.ContextMenu>
</Button>