Hello!
In my CellValuePresenter I defined a XamNumericEditor that is using an other XamNumericEditor as EditTemplate. The difference is that I want to bind the Value property to an other source.
Unfortunately I have to double click in the cell to start edit mode (so that the masked is displayed). If I click once the field takes the entered chars, but does not show it in the control.
How can I start edit mode by click only once in the field? Or even better might be, if edit mode starts when the field gets focus (if the user uses tab to go though the grid)!
Please check out the attached example!
Thanks, Florian
No ideas or comments? Does anyone have the same issue?
Florian
Started this topic a long time ago, but I am still interested in a solution!
Hello Florian,
Excuse me for the late reply. I have been looking into your description and this seems expected taken the your edit template. It really doesn't seem to make sense using the XamNumericEditor like that. Would you please describe what are you trying to achieve and why are you using the editor in this manner, so that I can get a better understanding of your requirement and probably suggest another approach to better fit your scenario.
Looking forward to hearing from you.
Sincerely,
Petar, MCTS
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hello Petar!
OK, I will try to explain what and why I am doing it like this.
As you can imagine I attached a simplified example. The reason why I am doing it like this, is that in our real application the user can switch between absolute and relative values. When the user chooses that relative values should be shown, the property ValueContainer.Value is changed to a relative value and the PropertyChanged event is raised. But as soon as the user clicks into the cell to edit the value, the user should see the absolute value ValueContainer.DoubleValue which the user then can edit.
So bascially I want to show one property of my ValueContainer, but when the user starts editing, he should edit another property of the ValueContainer.
Could I make clear weant I want to achieve?
[Update] One more thing, just to give you a hint why I am using a style for the CellValuePresenter: I am setting the CellValuePresenterStyle to a special style. This is neccessary because I change the style depending on the value that is displayed (using a Trigger). Sometimes a column has not a numercial value but needs to be displayed as a drop down. I did not add this logic to the example.
OK, I found a very easy solution I think. I defined a Style-Trigger that watches the IsInEditMode of the XamNumericEdit. If it is in edit mode I use a binding to the DoubleValue field of the ValueContainer, and if it is not in edit mode I bind to the Value property (which is the calculated one).
Advantages of this solution is that I can do my calculation in the ValueContainer (where I have all the values to calculate) . Addtionally I do not need to have a separeted ValueConverter.
Petar, maybe you can quickly check if this is a proper solution. I attached my solution.
Thanks to open my eyes and pointing me into the right direction. Regards, Florian
Good Morning,
thanks, this works if the calculation can be done wihtout knowing the ValueContainer. But only the ValueContainer knows how to calculate the value that shall be displayed. Please check out my second example in WpfApplication2.1.zip.
In the ValueConverter I have no access to the ValueContainer. How can I access the ValueContainer in the proposed solution?
regards, Florian
Hi Florian,
This is exactly what I had understood last time, so I have modified your sample in a way that I myself would go for if I need such functionality. I have used a simple custom ValueConverter class on the XamNumericEditor and have disposed of your CellValuePresenter template, thus preserving all its functionality along with the XamNumericEditor’s.
Please test it out and let me know if this is what you were looking for, or if you require any further clarification on the matter.
Hi,
the reason why I cannot use DoubleValue only is the following. I want to display the property Value, which is a calculated value. But when the user starts editing he should work on DoubleValue, because when the user starts editing, he should see the value he is changing. And this is DoubleValue.
I added a slightly modified example.
Hope this makes things clearer. I tried to focus on my issue.
thanks, Florian
I still do not fully understand what is the end result you are trying to achieve . E.g. why aren't you using the DoubleValue property only. If there is some manipulation over the DoubleValue that you want to do before you showing it to the user you can do it in the get method without affecting your private property, or if you it would be like a formatting of sorts you can do it in the XamNumericEditor’s ValueToDisplayTextConverter.
Please try and elaborate your descriptions so I get you overall goal. Thanks in advance. Looking forward to your reply.