Hi,
We are binding the datasource to XamDataGrid . Please find the code snipper for the same.
<data:XamDataGrid DataSource="{Binding SpectrumList}" AutoFit="True" UseLayoutRounding="True"SortRecordsByDataType="True" x:Name="xamDataGrid" GroupByAreaLocation="None" >
<data:XamDataGrid.FieldLayoutSettings>
<data:FieldLayoutSettings AutoGenerateFields="True" AllowAddNew="False" AllowRecordFixing="No"AllowDelete="False" AllowFieldMoving="No" HighlightAlternateRecords="True"/>
</data:XamDataGrid.FieldLayoutSettings>
<data:XamDataGrid.FieldSettings>
<data:FieldSettings AllowEdit="False"/>
</data:XamDataGrid.FieldSettings>
</data:XamDataGrid
1) By default we are setting the AlloEdit to false for all the columns.We have a requirement to modify the few columns data .
We want to write a Trigger to identify the columns and make the columns editable. Please suggest some solution for the same.
Regards,
Yugandher
Hi Stephan,
Oh I see.. Thanks for the idea.. Helps a lot.. :)
Thanks,
Hello Sue,
The header record will always be called and the approach you use is a good one. You can check if the Record type is HeaderRecord, but the logic is the same and just the check is different.
ahh.. I missed that one.. Yes, the idea definitely helped. I ended up using the CellValuePresenter and use a MutiValueConverter binding to enable/disabled based on certain conditions and it works like a charm.. :)
During the process I noticed that everyrow of the Datagrid is called (including the grid's Header row) Is there a way around this other than using "DataContext.DataItemIndex >=0 as a condition to prevent the converter from failing (because the DataItem for the header is null.. :))
Have you seen the sample with the Triggers for the Editors ("XamDataGridAllowEditTrigger.zip")? There no Fields are defined and I believe that you can use this approach in your scenario. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
This post was useful. However I have a followup question
In my project (using MVVM) I am creating the Columns Dynamically. Now when a row is selected, particular columns of that row, need to be allowedit = true and others false. Can you please suggest how I can go about doing this??
Thanks in advance..