我需要根据属性在 datagridCell 上设置 IsReadOnly 属性。
<WPFCtrlDG:ExtDataGrid Grid.Row="2"
InternalAddCommandHandling="False"
InternalDeleteCommandsHandling="False"
ItemsSource="{Binding Path=Attributes, Mode=TwoWay}"
Command="{Binding Path=AttributesCommand}">
<WPFCtrlDG:ExtDataGrid.Columns>
<WPFCtrlDG:ExtDataGridTextColumn Header="Attribute" Tag="ID_ATTRIBUTE" Width="*" IsReadOnly="{Binding Path=FL_COMMON, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
<WPFCtrlDG:ExtDataGridTextColumn Header="Value" Tag="ID_VALUE" Width="*" IsReadOnly="true"/>
</WPFCtrlDG:ExtDataGrid.Columns>
</WPFCtrlDG:ExtDataGrid>
public BindingList<SPC_SPL2_ATTRIBUTE> Attributes
{
get
{
if (Context.SPC_SPL2_ATTRIBUTE == null)
Controller.Execute(delegate(IResult result)
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("FL_ACTIVE", true);
parameters.Add("CD_SPL2", CurrentSPL2.CD_SPL2);
Model.Invalidate(typeof(SPC_SPL2_ATTRIBUTE), Filter.GENERIC<SPC_SPL2_ATTRIBUTE>(parameters, "ID_ATTRIBUTE"));
if (Model.Appendload(result) == false)
return false;
return result.Successful;
});
return Context.SPC_SPL2_ATTRIBUTE;
}
set { Context.SPC_SPL2_ATTRIBUTE = value; }
}
FL_COMMON 是一个布尔属性,位于数据网格中显示的对象内,但我编写的代码不起作用,而如果我将 IsreadOnly 设置为 true,它就可以工作。
我究竟做错了什么?谢谢你