示例#1
0
        private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataGridLengthEditorGrid editorGrid = (DataGridLengthEditorGrid)d;

            if (!editorGrid._loadingValue)
            {
                string newText = (string)e.NewValue;
                // We only want to update the value when the user has typed something in
                if (String.IsNullOrEmpty(newText))
                {
                    editorGrid._textBox.Text = editorGrid._lastValidPixelWidth.ToString(CultureInfo.InvariantCulture);
                    return;
                }
                editorGrid.SetLengthValue();
            }
            else
            {
                // Even though we're just loading the Value, we still need to cache
                // the lastValidPixelWidth because it may have been set through xaml
                double pixels;
                if (double.TryParse(editorGrid._textBox.Text, out pixels))
                {
                    editorGrid._lastValidPixelWidth = pixels;
                }
            }
        }
示例#2
0
        private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataGridLengthEditorGrid editorGrid = (DataGridLengthEditorGrid)d;

            if (!editorGrid.AreHandlersSuspended())
            {
                editorGrid.LoadLengthValue((SSWC.DataGridLength)e.NewValue);
            }
        }