Example #1
0
        private static UIElement TabControlTemplate(UIElement element)
        {
            var grid = new Grid()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());

            var selectedTabContent = new ContentControl()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            BindingOperations.SetBinding(element, "SelectedItem.Content", selectedTabContent.GetProperty("Content"));

            var headerPanel = new ItemsControl()
            {
                ItemsPanel = new StackPanel()
                {
                    Orientation = Orientation.Horizontal
                },
                ItemTemplate = new DataTemplate(TabHeaderTemplate),
            };

            BindingOperations.SetBinding(element.GetProperty("Items"), headerPanel.GetProperty("ItemsSource"));

            grid.Children.Add(headerPanel);
            grid.Children.Add(selectedTabContent);

            grid.SetRow(0, headerPanel);
            grid.SetColumn(0, headerPanel);

            grid.SetRow(1, selectedTabContent);
            grid.SetColumn(0, selectedTabContent);

            var border = new Border()
            {
                Child = grid,
            };

            BindingOperations.SetBinding(element.GetProperty("Padding"), border.GetProperty("Padding"));
            BindingOperations.SetBinding(element.GetProperty("Background"), border.GetProperty("Background"));
            BindingOperations.SetBinding(element.GetProperty("BorderThickness"), border.GetProperty("BorderThickness"));
            BindingOperations.SetBinding(element.GetProperty("BorderColor"), border.GetProperty("BorderColor"));

            return(border);
        }
		public StackPanelChild (UIElement child)
		{
			Content = child;
			
			HorizontalAlignment = HorizontalAlignment.Center;

			BindingOperations.SetBinding (child.GetProperty ("Margin"), GetProperty ("Margin"));
			BindingOperations.SetBinding (child.GetProperty ("HorizontalAlignment"), GetProperty ("HorizontalAlignment"));
			BindingOperations.SetBinding (child.GetProperty ("VerticalAlignment"), GetProperty ("VerticalAlignment"));
			BindingOperations.SetBinding (child.GetProperty ("Visibility"), GetProperty ("Visibility"));
		}
        public StackPanelChild(UIElement child)
        {
            Content = child;

            HorizontalAlignment = HorizontalAlignment.Center;

            BindingOperations.SetBinding(child.GetProperty("Margin"), GetProperty("Margin"));
            BindingOperations.SetBinding(child.GetProperty("HorizontalAlignment"), GetProperty("HorizontalAlignment"));
            BindingOperations.SetBinding(child.GetProperty("VerticalAlignment"), GetProperty("VerticalAlignment"));
            BindingOperations.SetBinding(child.GetProperty("Visibility"), GetProperty("Visibility"));
        }
Example #4
0
        private static UIElement ItemsControlTemplate(UIElement element)
        {
            var border = new Border();

            BindingOperations.SetBinding(element.GetProperty("Padding"), border.GetProperty("Padding"));
            BindingOperations.SetBinding(element.GetProperty("Background"), border.GetProperty("Background"));
            BindingOperations.SetBinding(element.GetProperty("BorderThickness"), border.GetProperty("BorderThickness"));
            BindingOperations.SetBinding(element.GetProperty("BorderColor"), border.GetProperty("BorderColor"));

            BindingOperations.SetBinding(element.GetProperty("ItemsPanel"), border.GetProperty("Child"));

            return(border);
        }
		private static UIElement ButtonTemplate (UIElement element)
		{
			var border = new Border ();
			border.CornerRadius = new CornerRadius (3);
			
			BindingOperations.SetBinding (element.GetProperty ("Padding"), border.GetProperty ("Padding"));
			BindingOperations.SetBinding (element.GetProperty ("Background"), border.GetProperty ("Background"));
			BindingOperations.SetBinding (element.GetProperty ("BorderThickness"), border.GetProperty ("BorderThickness"));
			BindingOperations.SetBinding (element.GetProperty ("BorderColor"), border.GetProperty ("BorderColor"));
			
			BindingOperations.SetBinding (element.GetProperty ("Content"), border.GetProperty ("Child"));
			
			return border;		
		}
Example #6
0
        private static UIElement ButtonTemplate(UIElement element)
        {
            var border = new Border();

            border.CornerRadius = new CornerRadius(3);

            BindingOperations.SetBinding(element.GetProperty("Padding"), border.GetProperty("Padding"));
            BindingOperations.SetBinding(element.GetProperty("Background"), border.GetProperty("Background"));
            BindingOperations.SetBinding(element.GetProperty("BorderThickness"), border.GetProperty("BorderThickness"));
            BindingOperations.SetBinding(element.GetProperty("BorderColor"), border.GetProperty("BorderColor"));

            BindingOperations.SetBinding(element.GetProperty("Content"), border.GetProperty("Child"));

            return(border);
        }
		public CanvasChild (UIElement child)
		{
			x = BuildVisualProperty<double> ("X");
			y = BuildVisualProperty<double> ("Y");

			Content = child;

			BindingOperations.SetBinding (child.GetProperty ("Visibility"), GetProperty ("Visibility"));
		}
Example #8
0
        private static UIElement MenuItemTemplate(UIElement element)
        {
            var header = new ContentControl();

            BindingOperations.SetBinding(element.GetProperty("Header"), header.GetProperty("Content"));

            var popup = new Popup()
            {
                PlacementTarget  = element,
                VerticalOffset   = 6,
                HorizontalOffset = -5,
            };

            BindingOperations.SetBinding(element.GetProperty("ItemsPanel"), popup.GetProperty("Child"));
            BindingOperations.SetBinding(element.GetProperty("IsSubmenuOpen"), popup.GetProperty("IsOpen"));

            return(header);
        }
        public GridChild(UIElement child)
        {
            Content = child;

            BindingOperations.SetBinding(child.GetProperty("Visibility"), GetProperty("Visibility"));

            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Stretch;
        }
		public GridChild (UIElement child)
		{
			Content = child;

			BindingOperations.SetBinding (child.GetProperty ("Visibility"), GetProperty ("Visibility"));
			
			HorizontalAlignment = HorizontalAlignment.Stretch;
			VerticalAlignment = VerticalAlignment.Stretch;
		}	
Example #11
0
        public CanvasChild(UIElement child)
        {
            x = BuildVisualProperty <double> ("X");
            y = BuildVisualProperty <double> ("Y");

            Content = child;

            BindingOperations.SetBinding(child.GetProperty("Visibility"), GetProperty("Visibility"));
        }
Example #12
0
		private static UIElement MenuItemTemplate (UIElement element)
		{
			var header = new ContentControl ();
			BindingOperations.SetBinding (element.GetProperty ("Header"), header.GetProperty ("Content"));

			var popup = new Popup ()
			{
				PlacementTarget = element,
				VerticalOffset = 6,
				HorizontalOffset = -5,
			};

			BindingOperations.SetBinding (element.GetProperty ("ItemsPanel"), popup.GetProperty ("Child"));
			BindingOperations.SetBinding (element.GetProperty ("IsSubmenuOpen"), popup.GetProperty ("IsOpen"));

			return header;
		}
		private static UIElement ItemsControlTemplate (UIElement element)
		{
			var border = new Border ();
			
			BindingOperations.SetBinding (element.GetProperty ("Padding"), border.GetProperty ("Padding"));
			BindingOperations.SetBinding (element.GetProperty ("Background"), border.GetProperty ("Background"));
			BindingOperations.SetBinding (element.GetProperty ("BorderThickness"), border.GetProperty ("BorderThickness"));
			BindingOperations.SetBinding (element.GetProperty ("BorderColor"), border.GetProperty ("BorderColor"));
			
			BindingOperations.SetBinding (element.GetProperty ("ItemsPanel"), border.GetProperty ("Child"));
			
			return border;		
		}
		private static UIElement TabControlTemplate (UIElement element)
		{
			var grid = new Grid ()
			{
				HorizontalAlignment = HorizontalAlignment.Stretch,
				VerticalAlignment = VerticalAlignment.Stretch
			};
			
			grid.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto });
			grid.RowDefinitions.Add (new RowDefinition ());
			grid.ColumnDefinitions.Add (new ColumnDefinition ());
									
			var selectedTabContent = new ContentControl ()
			{
				HorizontalAlignment = HorizontalAlignment.Stretch,
				VerticalAlignment = VerticalAlignment.Stretch
			};
			BindingOperations.SetBinding (element, "SelectedItem.Content", selectedTabContent.GetProperty ("Content"));

			var headerPanel = new ItemsControl ()
			{
				ItemsPanel = new StackPanel() { Orientation = Orientation.Horizontal },
				ItemTemplate = new DataTemplate(TabHeaderTemplate),
			};
			BindingOperations.SetBinding (element.GetProperty ("Items"), headerPanel.GetProperty ("ItemsSource"));

			grid.Children.Add (headerPanel);
			grid.Children.Add (selectedTabContent);
			
			grid.SetRow (0, headerPanel);
			grid.SetColumn (0, headerPanel);
			
			grid.SetRow (1, selectedTabContent);
			grid.SetColumn (0, selectedTabContent);
			
			var border = new Border ()
			{
				Child = grid,
			};

			BindingOperations.SetBinding (element.GetProperty ("Padding"), border.GetProperty ("Padding"));
			BindingOperations.SetBinding (element.GetProperty ("Background"), border.GetProperty ("Background"));
			BindingOperations.SetBinding (element.GetProperty ("BorderThickness"), border.GetProperty ("BorderThickness"));
			BindingOperations.SetBinding (element.GetProperty ("BorderColor"), border.GetProperty ("BorderColor"));
			
			return border;
		}