Exemple #1
0
		public FractionArea ()
		{
			Content = panel;		
			
			Dividend = new ContentControl () 
			{
				Content = new TextArea(),
				Margin = new Thickness (5, 0, 5, 3),
				HorizontalAlignment = HorizontalAlignment.Center
			};

			Divisor = new ContentControl () 
			{
				Content = new TextArea(),
				Margin = new Thickness (5, 2, 5, 0),
				HorizontalAlignment = HorizontalAlignment.Center
			};
			
			var line = new Line ()
			{
				HeightRequest = 2,
				StrokeThickness = 2,
				HorizontalAlignment = HorizontalAlignment.Stretch,
			};
			
			panel.Children.Add (Dividend);
			panel.Children.Add (line);			
			panel.Children.Add (Divisor);

			BindingOperations.SetBinding (this, "DataContext.Dividend", Dividend.GetProperty ("Content"), new TokenAreaConverter ());
			BindingOperations.SetBinding (this, "DataContext.Divisor", Divisor.GetProperty ("Content"), new TokenAreaConverter ());

			Margin = new Thickness (2, 0, 2, 0);
		}
		public ExponentiationArea ()
		{
			Base = new ContentControl () 
			{
				Content = new TextArea(),
				Margin = new Thickness (0, 3, 3, 0)
			};

			Power = new ContentControl () 
			{
				Content = new TextArea(),
				RenderTransform = new ScaleTransform(0.75, 0.75),
				LayoutTransform = new ScaleTransform(0.75, 0.75),
				//BorderColor = Colors.Blue
			};

			var grid = new Grid ();

			grid.Children.Add (Base);
			grid.Children.Add (Power);

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

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

			BindingOperations.SetBinding (this, "DataContext.Base", Base.GetProperty ("Content"), new TokenAreaConverter ());
			BindingOperations.SetBinding (this, "DataContext.Power", Power.GetProperty ("Content"), new TokenAreaConverter ());

			Content = grid;
		}
		public ParenthesesArea ()
		{
			Child = new ContentControl ()
			{
				Content = new TextArea (),
				VerticalAlignment = VerticalAlignment.Center
			};

			var stackPanel = new StackPanel ()
			{
				Orientation = Orientation.Horizontal
			};

			stackPanel.Children.Add (new OpenParentheses ());
			stackPanel.Children.Add (Child);

			var closeParentheses = new CloseParentheses ();
			BindingOperations.SetBinding (this, "DataContext.ShowCloseParentheses", closeParentheses.GetProperty ("Visibility"), new BooleanToVisibilityConverter ());

			stackPanel.Children.Add (closeParentheses);

			Content = stackPanel;

			BindingOperations.SetBinding (this, "DataContext.Child", Child.GetProperty ("Content"), new TokenAreaConverter ());		
		}
Exemple #4
0
		public ResultArea ()
		{
			var line1 = new Line ()
			{
				WidthRequest = 12,
				HeightRequest = 2,
				StrokeThickness = 2,
				Stroke = Colors.Black,
				SnapsToDevicePixels = true
			};

			var line2 = new Line ()
			{
				WidthRequest = 12,
				HeightRequest = 2,
				StrokeThickness = 2,
				Stroke = Colors.Black,
				SnapsToDevicePixels = true
			};

			var canvas = new Canvas ();
			canvas.HeightRequest = 12;
			canvas.WidthRequest = 12;

			canvas.Children.Add (line1);
			canvas.Children.Add (line2);

			canvas.SetTop (3, line1);
			canvas.SetTop (7, line2);

			Child = new ContentControl ()
			{
				Content = new TextArea (),
				Margin = new Thickness (2, 0, 0, 0)
			};

			var stackPanel = new StackPanel ()
			{
				Orientation = Orientation.Horizontal
			};

			stackPanel.Children.Add (canvas);
			stackPanel.Children.Add (Child);

			Content = stackPanel;

			BindingOperations.SetBinding (this, "DataContext.Child", Child.GetProperty ("Content"), new TokenAreaConverter ());

			Margin = new Thickness (2, 0, 0, 0);
		}
Exemple #5
0
		public SquareRootArea ()
		{
			Child = new ContentControl ()
			{
				Content = new TextArea (),
				Margin = new Thickness(12, 3 ,2, 0)
			};

			var grid = new Grid ();
			grid.Children.Add (Child);
			grid.Children.Add (new SquareRootPath ());

			Content = grid;

			BindingOperations.SetBinding (this, "DataContext.Child", Child.GetProperty ("Content"), new TokenAreaConverter ());
		}
Exemple #6
0
		public AbsoluteArea ()
		{
			Child = new ContentControl ()
			{
				Content = new TextArea (),
				VerticalAlignment = VerticalAlignment.Center,
				Margin = new Thickness(3)
			};

			var stackPanel = new StackPanel ()
			{
				Orientation = Orientation.Horizontal
			};

			stackPanel.Children.Add (new Line () { WidthRequest = 2, VerticalAlignment = VerticalAlignment.Stretch, StrokeThickness = 2, });
			stackPanel.Children.Add (Child);
			stackPanel.Children.Add (new Line () { WidthRequest = 2, VerticalAlignment = VerticalAlignment.Stretch, StrokeThickness = 2, });

			Content = stackPanel;

			BindingOperations.SetBinding (this, "DataContext.Child", Child.GetProperty ("Content"), new TokenAreaConverter ());	
		}
Exemple #7
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 TabHeaderTemplate (object o)
		{
			var item = o as ItemView;

			var tabHeader = new ContentControl ();
			BindingOperations.SetBinding (item.Visual.GetProperty ("Header"), tabHeader.GetProperty ("Content"));

			var headerBorder = new Border ()
			{
				Background = new SolidColorBrush(new Color(0xf2, 0xf1, 0xf0)),
				Child = tabHeader,
				Padding = new Thickness(5),
				BorderThickness = 0,
			};

			return headerBorder;
		}
		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;
		}