public CadRectangleSizePanel(CadRectangle cadRectangle)
 {
     InitializeComponent();
     WidthUpDn.DataContext = cadRectangle.LRect;
     WidthUpDn.SetBinding(NumericUpDown.ValueProperty, "Width");
     HeightUpDn.DataContext = cadRectangle.LRect;
     HeightUpDn.SetBinding(NumericUpDown.ValueProperty, "Height");
 }
Пример #2
0
        public void DataContextUpdate(CadObject cadObject)
        {
            this.IsEnabled = true;
            XUpDn.Value    = cadObject.X;
            XUpDn.SetBinding(NumericUpDown.ValueProperty, "X");
            XUpDn.DataContext = cadObject;

            YUpDn.Value = cadObject.Y;
            YUpDn.SetBinding(NumericUpDown.ValueProperty, "Y");
            YUpDn.DataContext = cadObject;

            ZUpDn.Value = cadObject.Z;
            ZUpDn.SetBinding(NumericUpDown.ValueProperty, "Z");
            ZUpDn.DataContext = cadObject;

            MirrorCheck.DataContext = cadObject;
            MirrorCheck.IsChecked   = cadObject.Mirror;
            MirrorCheck.SetBinding(CheckBox.IsCheckedProperty, "Mirror");

            RenderCheck.IsChecked = cadObject.Render;
            RenderCheck.SetBinding(CheckBox.IsCheckedProperty, "Render");
            RenderCheck.DataContext = cadObject;

            FixCheck.IsChecked = cadObject.IsFix;
            FixCheck.SetBinding(CheckBox.IsCheckedProperty, "IsFix");
            FixCheck.DataContext = cadObject;

            AngleZUpDn.Value = cadObject.AngleZ;
            AngleZUpDn.SetBinding(NumericUpDown.ValueProperty, "AngleZ");
            AngleZUpDn.DataContext = cadObject;

            AngleYUpDn.Value = cadObject.AngleY;
            AngleYUpDn.SetBinding(NumericUpDown.ValueProperty, "AngleY");
            AngleYUpDn.DataContext = cadObject;

            AngleXUpDn.Value = cadObject.AngleX;
            AngleXUpDn.SetBinding(NumericUpDown.ValueProperty, "AngleX");
            AngleXUpDn.DataContext = cadObject;

            WidthUpDn.Value    = cadObject.ScaleX;
            WidthUpDn.Interval = MonchaCadViewer.Properties.Settings.Default.stg_scale_percent == true ? 1 : 0.01;
            Binding bindingScaleX = new Binding("ScaleX");

            bindingScaleX.Converter = new ScaleConverter(MonchaCadViewer.Properties.Settings.Default.stg_scale_percent, MonchaCadViewer.Properties.Settings.Default.stg_scale_invert);
            WidthUpDn.SetBinding(NumericUpDown.ValueProperty, bindingScaleX);
            WidthUpDn.DataContext = cadObject;

            HeightUpDn.Value    = cadObject.ScaleY;
            HeightUpDn.Interval = MonchaCadViewer.Properties.Settings.Default.stg_scale_percent == true ? 1 : 0.01;
            Binding bindingScaleY = new Binding("ScaleY");

            bindingScaleY.Converter = new ScaleConverter(MonchaCadViewer.Properties.Settings.Default.stg_scale_percent, MonchaCadViewer.Properties.Settings.Default.stg_scale_invert);
            HeightUpDn.SetBinding(NumericUpDown.ValueProperty, bindingScaleY);
            HeightUpDn.DataContext = cadObject;

            DeepUpDn.Value    = cadObject.ScaleZ;
            DeepUpDn.Interval = MonchaCadViewer.Properties.Settings.Default.stg_scale_percent == true ? 1 : 0.01;
            Binding bindingScaleZ = new Binding("ScaleZ");

            bindingScaleZ.Converter = new ScaleConverter(MonchaCadViewer.Properties.Settings.Default.stg_scale_percent, MonchaCadViewer.Properties.Settings.Default.stg_scale_invert);
            DeepUpDn.SetBinding(NumericUpDown.ValueProperty, bindingScaleZ);
            DeepUpDn.DataContext = cadObject;
        }