On / off button when selecting a list
I have a ListBox
<ListBox Background="WhiteSmoke"
Name="LstComponents"
ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ComponentID}" />
<TextBlock Text=" - " />
<TextBlock Text="{Binding ComponentName}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
and a few buttons
<Button Content="Add New Components"
Name="BtnAdd"
Margin="5"
Click="BtnAdd_Click" />
<Button Content="Update Components"
Name="BtnUpdate"
Grid.Column="1"
Margin="5"
Click="BtnUpdate_Click" />
<Button Content="Delete Components"
Grid.Column="2"
Name="BtnDelete"
Margin="5"
Click="BtnDelete_Click" />
Now I wanted the Update and Delete button to be disabled when loaded, whereas it should enable if a list item in the ListBox is selected.
I don't want to write code for it. Suggest Plz? How can I accomplish this task in XAML
+3
user3890009
source
to share