リストボックスの宣言で、すべてのアイテムがそのスタイルを持っていると言えるでしょうか? 現在、私はすべてのアイテムを伝えなければなりません。
1 に答える
0
ItemTemplate を設定できます。
<Window.Resources>
<Style x:Key="SomeControlStyle" TargetType="SomeControl" >
<Setter Property="BorderThickness" Value="2"/>
</Style>
<DataTemplate x:Key="ADataTemplate">
<SomeControl Style="{StaticResource SomeControlStyle}"/>
</DataTemplate>
</Window.Resources>
<ListBox ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<SomeControl Style="{StaticResource SomeControlStyle}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
または:
<ListBox ItemsSource="{Binding}" ItemTemplate="{StaticResource ADataTemplate}"/>
于 2012-05-15T14:23:45.183 に答える