I have a XamDataGrid (code below) in which I am binding to the ActiveDataItem, which works and updates when items are selected. The issue is that although all fields are editable, and that works correctly, the "Add New Row" row is not editable, and neither are any of the filtering boxes. If I remove the ActiveDataItem binding, then all of these are editable, and work correctly. How can I fix this?
<igDP:XamDataGrid GroupByAreaLocation="None" DataSource="{Binding ChannelCollection}" Theme="{Binding Theme, Source={StaticResource MainVM}}" Margin="5" ScrollingMode="Immediate" ActiveDataItem="{Binding SelectedChannel}" IsSynchronizedWithCurrentItem="True"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowAddNew="True" AutoGenerateFields="False" AllowDelete="True" HighlightAlternateRecords="True" SelectionTypeCell="None" SelectionTypeField="None" SelectionTypeRecord="Single" AddNewRecordLocation="OnTop"/> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="True" AllowRecordFiltering="True" FilterOperatorDefaultValue="Contains" SortComparisonType="CaseInsensitive" AllowGroupBy="False" AllowHiding="Never" LabelTextAlignment="Center" LabelTextTrimming="CharacterEllipsis" LabelTextWrapping="NoWrap" /> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout IsDefault="True"> <igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription FieldName="Name" /> </igDP:FieldLayout.SortedFields> <igDP:Field DataType="{x:Type sys:String}" Name="Name" Label="Name" Visibility="Visible"></igDP:Field> <igDP:Field DataType="{x:Type sys:String}" Name="Unit" Label="Units" Visibility="Visible" ></igDP:Field> <igDP:Field DataType="{x:Type sys:Double}" Name="RangeMin" Label="Minimum Value" Visibility="Visible" ></igDP:Field> <igDP:Field DataType="{x:Type sys:Double}" Name="RangeMax" Label="Maximum Value" Visibility="Visible" ></igDP:Field> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Edit: after further review, I found that if the list is empty, then the Add New record is editable, but as soon as an item is added, it is no longer editable.
My grid is bound to an observable collection of a class that looks something like this:
<Serializable()> Public Class ChannelInfoViewModel Inherits ViewModelBase #Region "Private Members" Private _name As String Private _unit As String Private _minRange As Double = Double.NaN Private _maxRange As Double = Double.NaN Private _lineColor As Color #End Region #Region "Public Properties" Public Property Name As String Get Return _name End Get Set(ByVal value As String) _name = value RaisePropertyChanged("Name") End Set End Property Public Property Unit As String Get Return _unit End Get Set(ByVal value As String) _unit = value RaisePropertyChanged("Unit") End Set End Property Public Property RangeMin As Double Get Return _minRange End Get Set(ByVal value As Double) _minRange = value RaisePropertyChanged("RangeMin") End Set End Property Public Property RangeMax As Double Get Return _maxRange End Get Set(ByVal value As Double) _maxRange = value RaisePropertyChanged("RangeMax") End Set End Property Public Property LineColor As Color Get Return _lineColor End Get Set(ByVal value As Color) _lineColor = value RaisePropertyChanged("LineColor") End Set End Property #End Region #Region "Constructors" Public Sub New() End Sub #End Region Public Overrides Function ToString() As String Return Name + " (" + Unit + ")" End Function End Class
Hi,
I have been looking into your issue and would like to accurately reproduce it on my side so we can start working on it. I have a few questions though that would seem essential to the behavior you described. From your xaml I see you have bound your ActiveDataItem to a SelectedChannel property and have also used the Is IsSynchronizedWithCurrentItem property and so I was wondering if you could please provide us with an overall description of your data source, or if it is not going to be too much effort for you attach an isolated project that shows your issue in particualr.
Thank you in advance. Looking forward to hearing from you.
Any help?