I’m creating a Windows Gadget currently, it contains a Gridview in my Flyout. When the user clicks a button in the Flyout I want it to disable the rest of the buttons in the row, my xaml code is below:
<sdk:DataGrid AutoGenerateColumns="False" Height="245" HorizontalAlignment="Left" Margin="12,43,0,0" Name="dataIssue" VerticalAlignment="Top" Width="512">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Binding="{Binding Path=ID}" Header="ID"/>
<sdk:DataGridTextColumn Binding="{Binding Path=subject}" Header="Subject"/>
<sdk:DataGridTextColumn Binding="{Binding Path=project_ID}" Header="Project ID"/>
<sdk:DataGridTemplateColumn Width="80" Header="Timer">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Start" Click="Timer_Click"></Button>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
Any help on this would be appreciated, thanks!
The only thing I can think of is that you have a
SelectedIDon the viewmodel and bind theIsEnabledproperty of the button to the list through a converter. This would check if the ID of the element was the selected ID. If not then return false to disable the button.You’d need to check that if there’s nothing selected and return
trueto enable all the buttons.