public TiledImageButtonControl(ImageSource Source, int Width, int Height, StateSelector StateSelector)
		{
			this.Container = new Canvas
			{
				Width = Width,
				Height = Height,

				Clip = new RectangleGeometry
				{
					Rect = new Rect { X = 0, Y = 0, Width = Width, Height = Height }
				}

			};

			this.Tiles = new Image
			{
				Stretch = Stretch.Fill,
				Source = Source,

			}.AttachTo(this.Container);

			var s = new ImageTileSelector(this.Tiles, Width, Height);

			this.Overlay = new Rectangle
			{
				Fill = Brushes.White,
				Width = Width,
				Height = Height,
				Opacity = 0
			}.AttachTo(this.Container);

			this.States = new ImageButtonStates(this.Overlay,
				StateSelector.AsDisabled(s),
				StateSelector.AsEnabled(s),
				StateSelector.AsHot(s),
				StateSelector.AsPressed(s)
			);
		}
예제 #2
0
        public TiledImageButtonControl(ImageSource Source, int Width, int Height, StateSelector StateSelector)
        {
            this.Container = new Canvas
            {
                Width  = Width,
                Height = Height,

                Clip = new RectangleGeometry
                {
                    Rect = new Rect {
                        X = 0, Y = 0, Width = Width, Height = Height
                    }
                }
            };

            this.Tiles = new Image
            {
                Stretch = Stretch.Fill,
                Source  = Source,
            }.AttachTo(this.Container);

            var s = new ImageTileSelector(this.Tiles, Width, Height);

            this.Overlay = new Rectangle
            {
                Fill    = Brushes.White,
                Width   = Width,
                Height  = Height,
                Opacity = 0
            }.AttachTo(this.Container);

            this.States = new ImageButtonStates(this.Overlay,
                                                StateSelector.AsDisabled(s),
                                                StateSelector.AsEnabled(s),
                                                StateSelector.AsHot(s),
                                                StateSelector.AsPressed(s)
                                                );
        }