Intersoft.Client.Framework Namespace > ISSelectionItemControl Class : IsSelected Property |
<CategoryAttribute("Common Properties")> Public Property IsSelected As Boolean
Dim instance As ISSelectionItemControl Dim value As Boolean instance.IsSelected = value value = instance.IsSelected
[CategoryAttribute("Common Properties")] public bool IsSelected {get; set;}
[CategoryAttribute("Common Properties")] public: property bool IsSelected { bool get(); void set ( bool value); }
The item of a selection control is called Selection Item Control. This item control has IsSelected property that indicates whether the particular item is currently selected. Changing this property will also invalidate the whole selection process. This means that it will update the properties of the selection control such as SelectedIndex, SelectedItem, SelectedValue, etc.
The following example shows how IsSelected property works.
XAML |
Copy Code
|
---|---|
<Intersoft:DockPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <Intersoft:UXListBox x:Name="ListBox1" HorizontalAlignment="Center" VerticalAlignment="Center"> <Intersoft:UXListBoxItem Content="Item #1" IsSelected="True"/> <Intersoft:UXListBoxItem Content="Item #2"/> <Intersoft:UXListBoxItem Content="Item #3"/> <Intersoft:UXListBoxItem Content="Item #4"/> </Intersoft:UXListBox> <Intersoft:FieldLabel Intersoft:DockPanel.Dock="Top" Header="SelectedIndex"> <TextBlock Text="{Binding SelectedIndex, ElementName=ListBox1}" Margin="4"/> </Intersoft:FieldLabel> <Intersoft:FieldLabel Intersoft:DockPanel.Dock="Top" Header="SelectedItem"> <TextBlock Text="{Binding SelectedItem.Content, ElementName=ListBox1}" Margin="4"/> </Intersoft:FieldLabel> <Button Intersoft:DockPanel.Dock="Top" Content="Set Item #4.IsSelected = True" Margin="4" Click="Button_Click"/> </Intersoft:DockPanel> |
C# |
Copy Code
|
---|---|
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) { ((UXListBoxItem)this.ListBox1.Items[3]).IsSelected = true; } |
This sample demonstrates that whenever the selection is changed, the item's IsSelected property is also synchronized. Similar to the previous sample, you can also use IsSelected property to control the selection.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2