Ejemplo n.º 1
0
        public static void ControlThicknessPropertyChanged(object source, DependencyPropertyChangedEventArgs e)
        {
            GnosisGridCheckField gridCheckField = source as GnosisGridCheckField;
            int    newThickness = (int)e.NewValue;
            int    oldThickness = (int)e.OldValue;
            double paddingHorizontal;
            double paddingVertical;

            if (newThickness > oldThickness)
            {
                //increase border thickness, decrease padding
                paddingHorizontal = gridCheckField.HorizontalPadding - newThickness;
                paddingVertical   = gridCheckField.VerticalPadding - newThickness;
            }
            else
            {
                //decrease border thickness, increase padding
                paddingHorizontal = gridCheckField.Padding.Left + oldThickness;
                paddingVertical   = gridCheckField.Padding.Top + oldThickness;
            }

            if (paddingHorizontal >= 0 && paddingVertical >= 0)
            {
                gridCheckField.Padding = new Thickness(paddingHorizontal, paddingVertical, paddingHorizontal, paddingVertical);
                gridCheckField.chkBox.BorderThickness = new Thickness(newThickness);
            }
        }
Ejemplo n.º 2
0
        public static void ControlThicknessPropertyChanged(object source, DependencyPropertyChangedEventArgs e)
        {
            GnosisGridCheckField panelField = source as GnosisGridCheckField;
            int    newThickness             = (int)e.NewValue;
            int    oldThickness             = (int)e.OldValue;
            double marginHorizontal;
            double marginVertical;

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

            panelField.Margin          = new Thickness(marginHorizontal, marginVertical, marginHorizontal, marginVertical);
            panelField.BorderThickness = new Thickness(newThickness);
        }