Hi Guys, I have a simple ListBox laoded in WPF & I want to disable some items. How can i do this?
<ListBox Margin="10,55,0,0" x:Name="listBox1" FontSize="18" SelectionChanged="listBox1_SelectionChanged" HorizontalAlignment="Left" VerticalAlignment="Top" Width="130" Height="200" Background="GhostWhite"/>
ListBox values:
public TreeviewTest()
{
InitializeComponent();List<String> listOfNames = new List<String>() { "Animals", "Plants", "Nature", "Science", "People" }; Binding myBinding = new Binding(); //set binding parameters if necessary myBinding.Source = listOfNames; listBox1.SetBinding(ItemsControl.ItemsSourceProperty, myBinding);
}
I want to disable 'Nature' & 'People' in the ListBox. Thank you.
Karthik