public ObservableCollection<string> S { get; set; }
绑定到ListBox Control,S的switch元素,绑定fail.ListBox当前项目如下:
public string CurrentItem
{
get
{
return m_currentitem;
}
set
{
m_currentitem = value;
int index = S.IndexOf(value);
if (index >= 5)
{
string s = S[4];
S[4]= m_currentitem;
m_currentitem = s;
}
}
}
<ListBox ItemsSource="{Binding S}" SelectedItem="{Binding CurrentItem,Mode=TwoWay}" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="5" Loaded="UniformGrid_Loaded"></UniformGrid>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>