This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi there, If I use doubletextbox or textbox on DataGrid for the EdititingTemplate and set the UpdateSourceTrigger = LostFocus, the data model will not be updated even though I click away from the DataGrid (i.e. a button on same page/window). The only time it will get updated is to click on another cell on same datagrid. For example the template using the DoubleTextBox is like this: public static DataTemplate EditFloatingNumericTemplate(string propertyName, bool isReadonly, HorizontalAlignment hAlignment) { if (isReadonly) { return null; }
and the DisplayTemplate is: protected DataTemplate DisplayFloatingNumericTemplate(string propertyName, bool isReadonly, int precision, IValueConverter converter) { Binding itemBinding = new Binding(propertyName); itemBinding.Mode = isReadonly ? BindingMode.OneWay : BindingMode.TwoWay; itemBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; //UpdateSourceTrigger.LostFocus here will not work itemBinding.Converter = converter; FrameworkElementFactory editFactory = new FrameworkElementFactory(typeof(DoubleTextBox));
If I change it to UpdateSourceTrigger.PropertyChanged, then it works fine, but the problem is that it update the data model every single digit/characters entered, which is too much especially when we need to do something on the data updating. It also happens on other numerictextbox or textbox for editing. Can you fix the problem? We are still using 5.1 version, and don't want to risk use 6.0 version since our product release is in 3 weeks. |
|
|
Hello Gordon Thank you for brining this to our attention. This will be resolved in the next nightly build of 5.1. Jason Fauchelle |
|
|
Thanks Jason. This is fixed in May 03 nightly build. I have another problem, it seems that these Textbox, DoubleTextbox, IntegerTextbox and Numerictextbox will not honor the HorizontalContentAlignment/VerticalContentAlignment. for example, if I set the following: editFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.stretch); editFactory.SetValue(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Right); it will still appears on the left of the datagrid cell when editing. Can you fix them? After we release our product, We will update to version 6.0, so I hope the fixes will be in both 5.1 and 6.0. Thanks Gordon |
|
|
Hello Gordon The VerticalContentAlignment property is working fine for me. For horizontal alignment, I recommend using the TextAlignment property instead. All additions to 5.1 do eventually get merged into 6.0. If something seems to be missing at the time you upgrade to 6.0, just let me know and I'll do a full merge for you overnight. Jason Fauchelle |
|