mardi 24 avril 2018

Non Editable rows/Checkbox in Grid Control Xaml-C#

I am using DevExpress and C# to display a table in a grid . The itemsource of the Gridcontrol is an Observable collection of an Interface(ITableRowContents). The issue is that I cannot edit one of the items i.e., a checkbox present in each row? Please suggest where I am going wrong.

Xaml Code:

<Grid IsEnabled="True">
  <dxg:GridControl x:Name="Information" Background="#E3EFFF" 
                         ItemsSource="{Binding SelectedItems}" 
AutoGenerateColumns="AddNew" IsEnabled="True" >
    <dxg:GridControl.View>
      <dxg:TableView ShowGroupPanel="False"
               ShowGroupedColumns="False"
               AutoWidth="True"
               NavigationStyle="Row" 
               VerticalScrollbarVisibility="Visible"
               x:Name="RegistersGridView" >
      </dxg:TableView>
    </dxg:GridControl.View>
  </dxg:GridControl>
</Grid> 

C# Code:

private ObservableCollection<ITableRowContents> _SelectedItems;
public ObservableCollection<ITableRowContents> SelectedItems
    {
        get { return _SelectedItems; }
        set { _SelectedItems= value; OnPropertyChanged(); }
    }
public interface ITableRowContents
   {
     bool Selected { get; set; }
     string AddressStr { get; set; }
     string Name { get; set; }
    }
public class RegisterRow : ITableRowContents, INotifyPropertyChanged
   {
      private bool _selected;
      public bool Selected
       {
        get { return _selected; }
        set { _selected = value; OnPropertyChanged(); }
       }

    public string AddressStr { get; set; }
    public string Name { get; set; }
    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged([CallerMemberName]string propertyName = "")
    {
        PropertyChanged?.Invoke(this, new 
        PropertyChangedEventArgs(propertyName));
    }
   }




Aucun commentaire:

Enregistrer un commentaire