Пример #1
0
        public Window()
        {
            this.WindowStartUpLocation = WindowStartUpLocation.CenterScreen;

            rcBackground = new System.Windows.Shapes.Rectangle();
            rcBackground.StrokeThickness = 1;
            rcBackground.Parent          = this;
            rcBackground.RadiusX         = 0;
            rcBackground.RadiusY         = 0;

            rcBackground.SetBinding(
                System.Windows.Shapes.Rectangle.FillProperty,
                new Binding("Background")
            {
                Source = this,
                Mode   = BindingMode.OneWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            });

            rcBackground.SetBinding(
                System.Windows.Shapes.Rectangle.StrokeProperty,
                new Binding("BorderBrush")
            {
                Source = this,
                Mode   = BindingMode.OneWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            });
        }
Пример #2
0
		public Window () {
			this.WindowStartUpLocation = WindowStartUpLocation.CenterScreen;
            
            rcBackground = new System.Windows.Shapes.Rectangle();
			rcBackground.StrokeThickness = 1;
            rcBackground.Parent = this;
			rcBackground.RadiusX = 0;
			rcBackground.RadiusY = 0;

            rcBackground.SetBinding (
                System.Windows.Shapes.Rectangle.FillProperty, 
                new Binding("Background") { 
                    Source = this,
                    Mode = BindingMode.OneWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                });

            rcBackground.SetBinding (
                System.Windows.Shapes.Rectangle.StrokeProperty,
                new Binding("BorderBrush") {
                    Source = this,
                    Mode = BindingMode.OneWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                });
		}
Пример #3
0
        private void AddCanvas(double left, double top, double width, double height)
        {
            if (width > 0d && height > 0d)
            {
                var rect = new System.Windows.Shapes.Rectangle();

                var backgroundBinding = new Binding("ProtectorBrush");
                backgroundBinding.Source = this;
                rect.SetBinding(System.Windows.Shapes.Rectangle.FillProperty, backgroundBinding);

                Canvas.SetLeft(rect, left);
                Canvas.SetTop(rect, top);
                rect.Width  = width;
                rect.Height = height;

                _backgroundCanvas.Children.Add(rect);
            }
        }