C# WPF GridView SetReadOnly或基于复选框对列启用
我有一个C# WPF GridView SetReadOnly或基于复选框对列启用,c#,wpf,xaml,mvvm,C#,Wpf,Xaml,Mvvm,我有一个RadGridView(telerik版本的GridView),在这个RadGridView中我有以下列: <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Revoked}" AutoSelectOnEdit="True" Header="Revoked" UniqueName="Revoked" Width="Auto" IsReadOnly="False" FooterTextAlignment="Righ
RadGridView
(telerik版本的GridView
),在这个RadGridView
中我有以下列:
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Revoked}" AutoSelectOnEdit="True" Header="Revoked" UniqueName="Revoked" Width="Auto" IsReadOnly="False" FooterTextAlignment="Right" CellStyle="{StaticResource GridCellStyle}" />
NotificationAgreement类具有以下属性
/// <summary>
/// Gets or sets a value indicating whether revoked.
/// </summary>
public bool Revoked
{
get
{
return this.revoked;
}
set
{
this.revoked = value;
this.RaisePropertyChanged(() => this.Revoked);
}
}
//
///获取或设置一个值,该值指示是否已吊销。
///
公共图书馆被撤销
{
得到
{
退回此文件。已撤销;
}
设置
{
这个值=值;
this.RaisePropertyChanged(()=>this.reversed);
}
}
您可以粘贴您的ViewModel吗?我只想知道,当吊销被更改时,您正在向view发出通知
(1) 您的viewmodel应该有一个ObservableCollection
(2) yourObject
应该实现INotifyPropertyChanged
(3) 您的对象应该具有以下属性
private bool _revoked;
public bool Revoked
{
get{return _revoked;}
set { _revoked=value;
RaisPropertyChanged("Revoked");
}
这只是模拟代码,请按照您的方式执行。根据要求更新了我的问题
/// <summary>
/// Gets or sets a value indicating whether revoked.
/// </summary>
public bool Revoked
{
get
{
return this.revoked;
}
set
{
this.revoked = value;
this.RaisePropertyChanged(() => this.Revoked);
}
}
private bool _revoked;
public bool Revoked
{
get{return _revoked;}
set { _revoked=value;
RaisPropertyChanged("Revoked");
}