My problem is my checkbox content doesnt display underscores or the &
symbol. I've read about the RecognizeAccessKey
attribute, but i can't get it working. My listbox looks like this:
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemsSource="{Binding Channels}">
<ListBox.ItemTemplate>
<DataTemplate>
<ContentPresenter RecognizesAccessKey="False">
<CheckBox Content="{Binding Item}"
IsChecked="{Binding IsChecked}"
Width="149"
MinWidth="149" />
</ContentPresenter>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
Can anybody tell me how to get this fixed, so my Checkbox's content will display underscores and &
symbols?
thank you very much!
You could use TextBlock
as CheckBox.Content
, instead of binding it directly, and bind its Text
property
<CheckBox IsChecked="{Binding IsChecked}" Width="149" MinWidth="149">
<CheckBox.Content>
<TextBlock Text="{Binding Item}"/>
</CheckBox.Content>
</CheckBox>
By default CheckBox
will wrap TextBlock
in AccessText
when it displays Content
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With