【发布时间】:2013-07-15 08:41:17
【问题描述】:
我现在有
<Style x:Key="ListboxItemStyle" TargetType="{x:Type ListBoxItem}">
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="IsSelected" Value="True" />
</Trigger>
</Style.Triggers>
</Style>
但是问题是 SelectedIndex 返回到 -1 当我
对 UI 焦点进行一些其他控制。我正在寻找的行为
因为是当孩子获得焦点时选择ListBoxItem
但不会在孩子失去焦点时重置。
【问题讨论】:
-
this 不是您要找的东西吗?如果您不想要代码隐藏事件处理程序并且需要通过绑定进行通知,则可以将处理程序包装到行为中。