Hi there,
I have been tasked with creating a custom control that inherits from xamDataGrid and contains a delete button at the end of each row. I've seen in Alex's blog how to do this for a specific example (http://blogs.infragistics.com/blogs/alex_fidanov/archive/2009/07/14/shortcut-delete-button-on-xamdatagrid.aspx) but was wondering what would be the recommended way in a general way. Should I be appending another column on each row while databinding?
Any suggestions would be greatly appreciated.
Thanks.
Creating style in code behind in exactly the same as it looks in the xaml. Every nested tag is an object that is added into its parent. For example:
Style s = new Style(typeof(...));
s.Setters.Add(new Setter(...));
The triggers are added in the Triggers collection, etc.
Each field exposes an EditorStyle property that you have to set this style to, for example:
xamDataGrid1.FieldLayouts[0].Fields[0].Settings.EditorStyle=s;
Let me know if you have questions on this.
Hi I am trying to do a simular thing but all withing C# code. Can you help me with showing how you would set up the Setter and Style to apply to the FieldLayouts.....Editorstyle
Thanks
Hello,
There are couple of ways to do this.
1) Disable field moving
2) Handle events like FieldPositionChanging to cancel movement of that field
3) Instead of collapsing/showing this column, you can add it everytime the user hovers over the XamDataGrid's records
4) Hide the LabelPresenter for this field, when the user hovers over the LabelPresenter area so that it cannot be moved/clicked
Thanks Aaron for your prompt reply. I have downloaded and looked at the example from Alex's blog. In the example the markup that defines all of the fields for his particular grid (e.g. Employee information) and then sets the last field as an UnboundedField called deleteField.
I want to extend the control so that no matter what the other fields are, the last field is always a 'deleteField'.
Hello jpts,
If you haven't downloaded the sample that Alex posted, please be sure to scroll down on the page you mentioned and download the sample: 'testDeleteRecord.zip'. The column or 'field' would not actually be appended to the row or 'record' itself but would be added to the FieldLayout of the rows collection in which you want to add this functionality.
Referring to the sample that Alex provided would be the best first step to understanding how to apply the code published in the blog post.
Also, you can comment on the blog post itself with any specific inquiries regarding what he has done.