をaprreciatedされることを行うことができますどのように
:項目への変更をテストするための後ろ
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="ListBoxItem">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="AliceBlue" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<StackPanel>
<ListBox Name="bob" AlternationCount="2">
<ListBoxItem Content="Herald"/>
<ListBoxItem Content="Kumar" />
<ListBoxItem Content="Bill" />
<ListBoxItem Content="Dudley" />
<ListBoxItem Content="Jack" />
</ListBox>
<Button Click="Button_Click">boo</Button>
</StackPanel>
コード:
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim item1 As ListBoxItem = bob.Items(4)
bob.Items.Remove(item1)
bob.Items.Insert(0, item1)
End Sub
あなたが異なるRを望んでいたことを意味している場合私はあなたが代わりにMultiTriggerを使いたいと思っています。一つのトリガプロパティが交代インデックスで、一つのプロパティがどんなソートが使われているのかを示すプロパティに接続されています。 –