Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
XamNumericEditor value
posted

I have a very strange problem that someone may be able to give a hint about.
I am capturing the KeyDown events for the XamNumericEditor, if the key is a +-*or /, I pop a calculator and paste it's results into the value of the XamNumericEditor.
Works great if the XamNumericEditor is standalone. If it's in a datagrid and I change focus to another cell and back serveral times, the original value comes back in the cell.
It's as if the new data has not been passed to the bound data and the datagrid has refreshed itself.

Is there another event that I have to fire after the endEditMode to ensure 'everybody' knows about the 'pasted' data?

 <Style x:Key="XamNumericEditor" TargetType="{x:Type igEditors:XamNumericEditor}" >
                <EventSetter Event="PreviewKeyDown" Handler="xamNumericEditor1_PreviewKeyDown"/>
                <Setter Property="Mask" Value="nn,nnn.nnnn"/>
            </Style>
           
            private void xamNumericEditor1_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            XamNumericEditor xx = (XamNumericEditor)sender;

            if (e.Key == Key.Add ||
                e.Key == Key.Subtract ||
                e.Key == Key.Multiply ||
                e.Key == Key.Divide)
            {
                try
                {
                    var jj = xx.Value.ToString();
                    float val = float.Parse(jj);
                    calc1 ss = new calc1(val, e.Key);

                    ss.ShowDialog();
                    xx.Value = ss.result;
                    xx.Text = ss.result.ToString();
                    xx.EndEditMode(true,true);
                    e.Handled = true;
                }
                catch { }
            }
        }

 

Thanks in advance...