我是 silverlight 的新手,我必须根据条件在网格中禁用简单的任务禁用按钮!我知道在 asp.net 中这很容易,但我无法弄清楚如何在 Silverlight 中做到这一点。
Xml代码:
<sdk:DataGrid Style="{StaticResource DataGridStyle}" Width="900" SelectionMode="Extended" RowDetailsVisibilityMode="Collapsed" ItemsSource="{Binding Path=PagedRooms}" SelectedItem="{Binding Path=CurrentRoom, Mode=TwoWay}" AutoGenerateColumns="False" x:Name="outerdatagrid" >
<sdk:DataGrid.RowDetailsTemplate>
<DataTemplate>
<sdk:DataGrid ItemsSource="{Binding Path=ResourceAllocationTimePeriods, Mode=TwoWay}" x:Name="unblockBedGrid" AutoGenerateColumns="False" Width="850" Height="Auto" HorizontalAlignment="Left" Grid.Row="1" SelectedItem="{Binding Path=CurrentResourceAllocationTimePeriod, Mode=TwoWay}">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn IsReadOnly="True" Header="Allocated From" Binding="{Binding Path=StartDate,Mode=OneWay, Converter={StaticResource dateConverter}}" />
<sdk:DataGridTextColumn IsReadOnly="True" Header="Allocated To" Binding="{Binding Path=EndDate,Mode=OneWay, Converter={StaticResource dateConverter}}" />
<sdk:DataGridTemplateColumn>
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Height="23" Name="btnReleaseBed" Content="Release" Command="{Binding Path=ReleaseBedCommand}" />
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
</DataTemplate>
</sdk:DataGrid.RowDetailsTemplate>
</sdk:DataGrid>