0
我有一個WPF應用程序與ListBox顯示項目列表。 每個項目都有IsChecked屬性。專注於按鈕ListBoxItem內沒有代碼
我改變列表框的ItemContainerStyle的風格follos:
<Style x:Key="OrgListItemStyle" TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ToggleButton IsChecked="{Binding IsChecked}">
<ContentPresenter />
</ToggleButton>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
的問題是關注的焦點,用鍵盤導航時,是在ListBoxItem的,而不是切換按鈕本身,這使得與其合作並不直觀。
如何更改焦點,以便它在按鈕上而不是ListBoxItem - 最好不要與代碼。
謝謝 伊
謝謝,我真的讓自己緊張起來 - ItemsControl的是爲這個問題的解決方案。 – 2010-08-03 10:08:00