我正在为 Sharepoint 2010 开发 Silverlight Web 部件。我在数据网格中有一个按钮,如下所示
<sdk:DataGridTemplateColumn Width="80" >
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button x:Name="MarkBilledButton" Content="Mark Billed" VerticalAlignment="Center" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Click="MarkBilledButton_Click" />
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
private void MarkBilledButton_Click(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
//string buttonContent = btn.Content.ToString();
MedwaiverTimeLog timeLogObj = btn.DataContext as MedwaiverTimeLog;
MedwaiverViewModel MedwaiverViewModelObj = new MedwaiverViewModel();
MedwaiverViewModelObj.ChangeBillingStatus(timeLogObj.ListItemId, "Billed");
btn.IsEnabled = false;
}
我希望在按钮单击事件上发生的按钮单击时禁用按钮。但是当我点击那个禁用按钮时,它会被启用。一旦按钮被禁用,我不想启用它。这该怎么做?你能告诉我哪里出错了吗?或者您能否提供任何代码,以便我可以解决上述问题?