我有一个名单箱,定义如下:
<ListBox ... ItemTemplate="{DynamicResource User}"/>
项目2:
<DataTemplate x:Key="User">
<DataTemplate.Resources>
<Style TargetType="{x:Type Border}" x:Key="Ordinal">
<Setter Property="Background">
<Setter.Value>
...
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Border}" x:Key="Current">
<Setter Property="Background">
<Setter.Value>
...
</Setter.Value>
</Setter>
</Style>
</DataTemplate.Resources>
<Border CornerRadius="5" Padding="5" Margin="0,0,5,0" Style="{StaticResource Ordinal}">
...
</Border>
</DataTemplate>
Now I have an event handler which should set style of item in provided index to "current":
void SetCurrent(int Index)
{
?
}
如何做到这一点?
http://www.un.org。
也许使用项目Control会使这一点更加容易?