protected virtual void SetNodeOrientation(rMindNodeOriantation orientation) { m_node_orientation = orientation; Windows.UI.Xaml.Thickness thickness; switch (orientation) { case rMindNodeOriantation.Left: thickness = new Windows.UI.Xaml.Thickness(2, 6, 2, 6); break; case rMindNodeOriantation.Right: thickness = new Windows.UI.Xaml.Thickness(2, 6, 2, 6); break; case rMindNodeOriantation.Top: thickness = new Windows.UI.Xaml.Thickness(6, 2, 6, 2); break; case rMindNodeOriantation.Bottom: thickness = new Windows.UI.Xaml.Thickness(6, 2, 6, 2); break; default: thickness = new Windows.UI.Xaml.Thickness(2, 6, 2, 6); break; } Margin = thickness; }
protected virtual void SetNodeOrientation(rMindNodeOriantation orientation) { if (m_node_orientation == orientation) { return; } m_node_orientation = orientation; Thickness thickness; m_template.ColumnDefinitions.Clear(); m_template.RowDefinitions.Clear(); switch (orientation) { case rMindNodeOriantation.Left: m_template.VerticalAlignment = VerticalAlignment.Center; m_template.HorizontalAlignment = HorizontalAlignment.Left; m_template.ColumnDefinitions.Add(new ColumnDefinition()); m_template.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); Grid.SetColumn(m_area, 0); Grid.SetColumn(m_hit_area, 0); Grid.SetColumn(m_label, 1); Grid.SetRow(m_area, 0); Grid.SetRow(m_hit_area, 0); Grid.SetRow(m_label, 0); thickness = new Thickness(2, 6, 2, 6); break; case rMindNodeOriantation.Right: m_template.VerticalAlignment = VerticalAlignment.Center; m_template.HorizontalAlignment = HorizontalAlignment.Right; m_template.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); m_template.ColumnDefinitions.Add(new ColumnDefinition()); Grid.SetColumn(m_area, 1); Grid.SetColumn(m_hit_area, 1); Grid.SetColumn(m_label, 0); Grid.SetRow(m_area, 0); Grid.SetRow(m_hit_area, 0); Grid.SetRow(m_label, 0); thickness = new Thickness(2, 6, 2, 6); break; case rMindNodeOriantation.Top: m_template.VerticalAlignment = VerticalAlignment.Top; m_template.HorizontalAlignment = HorizontalAlignment.Center; m_template.RowDefinitions.Add(new RowDefinition()); m_template.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); Grid.SetColumn(m_area, 0); Grid.SetColumn(m_hit_area, 0); Grid.SetColumn(m_label, 0); Grid.SetRow(m_area, 0); Grid.SetRow(m_hit_area, 0); Grid.SetRow(m_label, 1); thickness = new Thickness(6, 2, 6, 2); break; case rMindNodeOriantation.Bottom: m_template.VerticalAlignment = VerticalAlignment.Bottom; m_template.HorizontalAlignment = HorizontalAlignment.Center; m_template.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); m_template.RowDefinitions.Add(new RowDefinition()); Grid.SetColumn(m_area, 0); Grid.SetColumn(m_hit_area, 0); Grid.SetColumn(m_label, 0); Grid.SetRow(m_area, 1); Grid.SetRow(m_hit_area, 1); Grid.SetRow(m_label, 0); thickness = new Thickness(6, 2, 6, 2); break; default: m_template.ColumnDefinitions.Add(new ColumnDefinition()); m_template.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); Grid.SetColumn(m_area, 0); Grid.SetColumn(m_hit_area, 0); Grid.SetColumn(m_label, 1); Grid.SetRow(m_area, 0); Grid.SetRow(m_hit_area, 0); Grid.SetRow(m_label, 0); thickness = new Thickness(2, 6, 2, 6); break; } Margin = thickness; }