public static void ControlThicknessPropertyChanged(object source, DependencyPropertyChangedEventArgs e)
        {
            GnosisDateTimeField dateTimeField = source as GnosisDateTimeField;
            int    newThickness = (int)e.NewValue;
            int    oldThickness = (int)e.OldValue;
            double marginHorizontal;
            double marginVertical;

            if (newThickness > oldThickness)
            {
                //increase border thickness, decrease margin
                marginHorizontal = dateTimeField.Margin.Left - newThickness;
                marginVertical   = dateTimeField.Margin.Top - newThickness;
            }
            else
            {
                //decrease border thickness, increase margin
                marginHorizontal = dateTimeField.Margin.Left + oldThickness;
                marginVertical   = dateTimeField.Margin.Top + oldThickness;
            }

            if (marginHorizontal >= 0 && marginVertical >= 0)
            {
                dateTimeField.Margin          = new Thickness(marginHorizontal, marginVertical, marginHorizontal, marginVertical);
                dateTimeField.BorderThickness = new Thickness(newThickness);

                double fieldHeight = GlobalData.Singleton.StyleHelper.GetFieldHeight(dateTimeField, dateTimeField.datePicker.FontFamily.ToString(),
                                                                                     (int)dateTimeField.datePicker.FontSize);
                dateTimeField.SetHeight(fieldHeight);
            }
        }
示例#2
0
        public void AddGnosisDateTimeFieldImplementation(IGnosisDateTimeFieldImplementation gnosisControlImplementation, int column, int row, int colSpan, int rowSpan)
        {
            GnosisDateTimeField dateTimeField = (GnosisDateTimeField)gnosisControlImplementation;

            Grid.SetColumn(dateTimeField, column);
            Grid.SetColumnSpan(dateTimeField, colSpan);
            Grid.SetRow(dateTimeField, row);
            Grid.SetRowSpan(dateTimeField, rowSpan);
            contentGrid.Children.Add(dateTimeField);
        }