public RotationAreaEditor()
            : base()
        {
            settingsPanel.Items.Add(
                new StackLayoutItem
            {
                Control = new UnitGroup
                {
                    Text        = "Rotation",
                    Unit        = "°",
                    ToolTip     = "Angle of rotation about the center of the area.",
                    Orientation = Orientation.Horizontal,
                    Content     = rotation = new FloatNumberBox()
                }
            }
                );

            var rotationBinding = AreaBinding.Child(c => c.Rotation);

            rotation.ValueBinding.Bind(rotationBinding);
        }
示例#2
0
        public AreaEditor()
        {
            this.Content = new StackLayout
            {
                Spacing = 5,
                Items   =
                {
                    new StackLayoutItem
                    {
                        Expand = true,
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        Control             = new Panel
                        {
                            Padding = new Padding(5),
                            Content = display = new AreaDisplay()
                        }
                    },
                    new StackLayoutItem
                    {
                        HorizontalAlignment = HorizontalAlignment.Center,
                        Control             = settingsPanel = new StackLayout
                        {
                            Orientation = Orientation.Horizontal,
                            Spacing     = 5,
                            Items       =
                            {
                                new StackLayoutItem
                                {
                                    Control = widthGroup = new UnitGroup
                                    {
                                        Text        = "Width",
                                        Unit        = Unit,
                                        ToolTip     = $"Area width in {Unit}",
                                        Orientation = Orientation.Horizontal,
                                        Content     = width = new FloatNumberBox()
                                    }
                                },
                                new StackLayoutItem
                                {
                                    Control = heightGroup = new UnitGroup
                                    {
                                        Text        = "Height",
                                        Unit        = Unit,
                                        ToolTip     = $"Area height in {Unit}",
                                        Orientation = Orientation.Horizontal,
                                        Content     = height = new FloatNumberBox()
                                    }
                                },
                                new StackLayoutItem
                                {
                                    Control = xGroup = new UnitGroup
                                    {
                                        Text        = "X",
                                        Unit        = Unit,
                                        ToolTip     = $"Area center X offset in {Unit}",
                                        Orientation = Orientation.Horizontal,
                                        Content     = x = new FloatNumberBox()
                                    }
                                },
                                new StackLayoutItem
                                {
                                    Control = yGroup = new UnitGroup
                                    {
                                        Text        = "Y",
                                        Unit        = Unit,
                                        ToolTip     = $"Area center Y offset in {Unit}",
                                        Orientation = Orientation.Horizontal,
                                        Content     = y = new FloatNumberBox()
                                    }
                                }
                            }
                        }
                    }
                }
            };

            CreateMenu();

            widthGroup.UnitBinding.Bind(UnitBinding);
            heightGroup.UnitBinding.Bind(UnitBinding);
            xGroup.UnitBinding.Bind(UnitBinding);
            yGroup.UnitBinding.Bind(UnitBinding);

            var widthBinding  = AreaBinding.Child((AreaSettings s) => s.Width);
            var heightBinding = AreaBinding.Child((AreaSettings s) => s.Height);
            var xBinding      = AreaBinding.Child((AreaSettings s) => s.X);
            var yBinding      = AreaBinding.Child((AreaSettings s) => s.Y);

            width.ValueBinding.Bind(widthBinding);
            height.ValueBinding.Bind(heightBinding);
            x.ValueBinding.Bind(xBinding);
            y.ValueBinding.Bind(yBinding);

            display.AreaBinding.Bind(AreaBinding);
            display.LockToUsableAreaBinding.Bind(LockToUsableAreaBinding);
            display.UnitBinding.Bind(UnitBinding);
            display.AreaBoundsBinding.Bind(AreaBoundsBinding);
            display.FullAreaBoundsBinding.Bind(FullAreaBoundsBinding);
            display.InvalidForegroundErrorBinding.Bind(InvalidForegroundErrorBinding);
            display.InvalidBackgroundErrorBinding.Bind(InvalidBackgroundErrorBinding);
        }