Hi,
I have a complex class as a field datasource in a xamDataGrid.
I also created a custom CellValuePresenter style where I define the ControlTemplate as a Label which is bound to the "value" property of the original class.
This Template contains several Style Triggers of it's own to show all the information I need (Changes background color, text font, etc based on certain properties of the original class as well).
Everything is working fine, except now I need to make these values editable from the grid.
Is there a way to define an editor (in this case xamNumericEditor) in the CellValuePresenterTemplate that would only show up when the cell enters edit mode and allow me to edit the value property in my underlying class?
Thanks,
Ricardo
I changed my control template from a Label to a XamNumericEditor and it almost worked.
I can now edit the content of the cells when I click on them but can't do it without using the mouse click.
"Enter" or "F2" don't work. How can I make it editable from the keyboard as soon as the cell gets focus, like excel?
Hello Ricardo,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hi Stefan,
I've just applied your suggestion to our project and it worked!
Thank you so much for your help!
I have been looking into your sample and I modified it, so now it works as you want. Basically I created the Style for the XamNumericEditor in the FieldLayputInitialized event handler in order top be able to use the index of the UnbounFields. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
I modified the example above to reflect my situation, I need to:
Thanks for your help,
Example: https://db.tt/dc596ghX
Sorry, but it still doesn't work.
I should've told you this before but wanted to keep the question simple:
One of the requirements is a variable number of columns, so I followed this example to create the columns:
http://es.infragistics.com/community/blogs/blagunas/archive/2012/10/24/xamdatagrid-dynamically-create-and-data-bind-columns-with-an-editor-of-your-choice.aspx
Each binding looks like this example:
BindingPath = new PropertyPath(String.Format("Periods[{0}].Hours", i))
It worked but then I needed access to more properties to create style triggers that would dynamically change the appearance of each cell.
So instead of setting the BindingPath to "Periods[i].Hours", I set it to "Periods[i]", and set the rest of the bindings in the XAML.
And that's where I'm at now, even if the binding is done this way, I think the binding path DataItem.Hours should work, or in my case: DataItem.Quantity.
I'll try to create a sample project and send it over, if it helps.