public void BackgroundGetThroughCode() { GridSplitter splitter = new GridSplitter(); Brush b = new SolidColorBrush(Colors.Black); splitter.SetValue(GridSplitter.BackgroundProperty, b); Assert.AreEqual(b, splitter.Background, "Getting Background property should pull from the backing dependency property."); }
public void GridSplitterTest() { Grid grid = new Grid(); grid.Height = 100.0; grid.Width = 100.0; grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions.Add(new RowDefinition()); grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.ColumnDefinitions.Add(new ColumnDefinition()); GridSplitter splitter = new GridSplitter(); splitter.SetValue(Grid.ColumnProperty, 1); splitter.SetValue(Grid.RowSpanProperty, 2); splitter.Width = 5.0; splitter.ShowsPreview = true; splitter.HorizontalAlignment = HorizontalAlignment.Left; grid.Children.Add(splitter); this.CreateAsyncTest(grid, () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(5.0, 6.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(5.0, 6.0, false)), delegate { Assert.IsNull(splitter._resizeData, "The stored ResizeData instance should be gone since the resize operation is over."); Assert.AreEqual(55.0, grid.ColumnDefinitions[0].ActualWidth, "The first column should have had the new width committed."); Assert.AreEqual(45.0, grid.ColumnDefinitions[1].ActualWidth, "The second column should have had the new width committed."); }); }
/// <summary> /// Add a panel to the display grid. /// </summary> private void AddPanelToDisplay(object sender, RoutedEventArgs args) { GridSplitter gridSplitter; IRegisteredPanel nextPanel = (IRegisteredPanel)sender; // Add the next panel ((UserControl)nextPanel).SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count); ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); ContentAreaGrid.Children.Add((UserControl)nextPanel); // Add a GridSplitter gridSplitter = new GridSplitter() { Height = 4.0d, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 3, 0, 3), Background = new SolidColorBrush(Colors.Transparent) }; gridSplitter.SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count); gridSplitter.SetValue(Grid.ColumnProperty, 0); ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); ContentAreaGrid.Children.Add(gridSplitter); }
internal void SplitViewHorizontally(ITextView textView) { m_dockPanel.Children.Clear(); _textViewHostList.Add(CreateTextViewHost()); var grid = BuildGrid(); var row = 0; for (int i = 0; i < _textViewHostList.Count; i++) { var textViewHost = _textViewHostList[i]; var control = textViewHost.HostControl; control.SetValue(Grid.RowProperty, row++); control.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(control); if (i + 1 < _textViewHostList.Count) { var splitter = new GridSplitter(); splitter.ResizeDirection = GridResizeDirection.Rows; splitter.HorizontalAlignment = HorizontalAlignment.Stretch; splitter.VerticalAlignment = VerticalAlignment.Stretch; splitter.ShowsPreview = true; splitter.SetValue(Grid.RowProperty, row++); splitter.SetValue(Grid.ColumnProperty, 0); splitter.Height = 5; splitter.Background = Brushes.Black; grid.Children.Add(splitter); } } m_dockPanel.Children.Add(grid); }
private Grid BuildGrid(ReadOnlyCollection <IVimViewInfo> viewInfoList) { Contract.Requires(viewInfoList.Count > 1); var grid = BuildGridCore(viewInfoList); var row = 0; for (int i = 0; i < viewInfoList.Count; i++) { var viewInfo = viewInfoList[i]; var textViewHost = viewInfo.TextViewHost; var control = textViewHost.HostControl; control.SetValue(Grid.RowProperty, row++); control.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(control); if (i + 1 < viewInfoList.Count) { var splitter = new GridSplitter(); splitter.ResizeDirection = GridResizeDirection.Rows; splitter.HorizontalAlignment = HorizontalAlignment.Stretch; splitter.VerticalAlignment = VerticalAlignment.Stretch; splitter.ShowsPreview = true; splitter.SetValue(Grid.RowProperty, row++); splitter.SetValue(Grid.ColumnProperty, 0); splitter.Height = 5; splitter.Background = Brushes.Black; grid.Children.Add(splitter); } } return(grid); }
public SplitContainer() { _panel1.SetValue(ColumnProperty, 0); _panel2.SetValue(ColumnProperty, 1); _splitter.SetValue(ColumnProperty, 0); _splitter.HorizontalAlignment = HorizontalAlignment.Right; ColumnDefinitions.Add(new ColumnDefinition()); ColumnDefinitions.Add(new ColumnDefinition()); Children.Add(_panel1); Children.Add(_panel2); Children.Add(_splitter); }
public void IsEnabledGetThroughCode() { GridSplitter splitter = new GridSplitter(); splitter.SetValue(GridSplitter.IsEnabledProperty, false); Assert.AreEqual(false, splitter.IsEnabled, "Getting IsEnabled property should pull from the backing dependency property."); }
public void ShowsPreviewGetThroughCode() { GridSplitter splitter = new GridSplitter(); splitter.SetValue(GridSplitter.ShowsPreviewProperty, false); Assert.AreEqual(false, splitter.ShowsPreview, "Getting ShowsPreview property should pull from the backing dependency property."); }
GridSplitter GridSplitterFactory(Int32 gridColumnIndex) { var gs = new GridSplitter(); gs.SetValue(Grid.ColumnProperty, gridColumnIndex); return(gs); }
internal static GridSplitter CreateGridSplitterThroughCode(int?row, int?column, int?rowSpan, int?columnSpan, double?height, double?width, VerticalAlignment?vAlign, HorizontalAlignment?hAlign, Brush background, bool?showsPreview) { GridSplitter splitter = new GridSplitter(); if (row != null) { splitter.SetValue(Grid.RowProperty, (int)row); } if (column != null) { splitter.SetValue(Grid.ColumnProperty, (int)column); } if (rowSpan != null) { splitter.SetValue(Grid.RowSpanProperty, (int)rowSpan); } if (columnSpan != null) { splitter.SetValue(Grid.ColumnSpanProperty, (int)columnSpan); } if (height != null) { splitter.Height = (double)height; } if (width != null) { splitter.Width = (double)width; } if (background != null) { splitter.Background = background; } if (showsPreview != null) { splitter.ShowsPreview = (bool)showsPreview; } if (hAlign != null) { splitter.HorizontalAlignment = (HorizontalAlignment)hAlign; } if (vAlign != null) { splitter.VerticalAlignment = (VerticalAlignment)vAlign; } return(splitter); }
/// <summary> /// Organizes the content of the tab. /// </summary> private void OrganizeTabContent() { PositionItemSource = new List <Positions>(); Random rand = new Random(); var imax = rand.Next(8, 10); for (int i = 0; i < imax; i++) { GenerateDumpPositions(rand); } var qry = new List <Positions>(PositionItemSource.DistinctBy(i => i.Pos).OrderBy(i => i.Pos)); AsynchronousQueryExecutor.Call(qry, l => PositionItemSource = new List <Positions>(l), null); TabGrid = new Grid(); TabGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new System.Windows.GridLength(5, System.Windows.GridUnitType.Star) }); TabGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = System.Windows.GridLength.Auto }); TabGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new System.Windows.GridLength(4, System.Windows.GridUnitType.Star) }); GridSplitter gridSplitter = new GridSplitter() { Width = 6 }; DataGrid = new DataGrid { Name = "PositionGrid", CanUserAddRows = true, ItemsSource = PositionItemSource }; ProgramEditor.SetValue(Grid.ColumnProperty, 0); gridSplitter.SetValue(Grid.ColumnProperty, 1); DataGrid.SetValue(Grid.ColumnProperty, 2); TabGrid.Children.Add(ProgramEditor); TabGrid.Children.Add(gridSplitter); TabGrid.Children.Add(DataGrid); TabContent = new Border { BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(221, 221, 221)), BorderThickness = new System.Windows.Thickness(1), CornerRadius = new System.Windows.CornerRadius(0, 0, 10, 10), Padding = new System.Windows.Thickness(5), Child = TabGrid }; }
public void PreviewStyleGetThroughCode() { GridSplitter splitter = new GridSplitter(); Style s = new Style(typeof(PreviewControl)); splitter.SetValue(GridSplitter.PreviewStyleProperty, s); Assert.AreEqual(s, splitter.PreviewStyle, "Getting PreviewStyle property should pull from the backing dependency property."); }
private void AddSplitter() { GridSplitter gs = new GridSplitter(); gs.Style = MainWindow.splitterStyle; gs.Width = MainWindow.SplitterWidth; gs.SetValue(Grid.ColumnProperty, this.ColumnDefinitions.Count - 1); this.Children.Add(gs); }
static GridSplitter CreateGridSplitter(int column) { GridSplitter splitter = new GridSplitter() { Width = 5, HorizontalAlignment = HorizontalAlignment.Left }; splitter.SetValue(Grid.ColumnProperty, column); return(splitter); }
public static Grid NewColumnSplittedGrid(FrameworkElement left, FrameworkElement right, Action <GridSplitter> afterGridSplitterInitialized = null) { var grid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(0, GridUnitType.Auto) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; var gridSplitter = new GridSplitter { Width = 7, Height = 90, ResizeBehavior = GridResizeBehavior.PreviousAndNext }; gridSplitter.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); afterGridSplitterInitialized?.Invoke(gridSplitter); left.SetValue(Grid.ColumnProperty, 0); gridSplitter.SetValue(Grid.ColumnProperty, 1); right.SetValue(Grid.ColumnProperty, 2); grid.Children.Add(left); grid.Children.Add(gridSplitter); grid.Children.Add(right); return(grid); }
public void RestructureGraphsGrid() { GraphsGrid.Children.Clear(); GraphsGrid.RowDefinitions.Clear(); var rowIndex = 0; foreach (var g in Presentation.Graphs) { GraphsGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star), MinHeight = 18 }); g.SetValue(Grid.RowProperty, rowIndex); g.SetValue(Grid.ColumnProperty, 0); GraphsGrid.Children.Add(g); rowIndex++; if (g != Presentation.Graphs.Last()) { GraphsGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); var splitter = new GridSplitter { Height = 5, HorizontalAlignment = HorizontalAlignment.Stretch }; splitter.SetValue(Grid.RowProperty, rowIndex); g.SetValue(Grid.ColumnProperty, 0); //var onMouseOver = new EventTrigger { Property = GridSplitter.IsMouseOverProperty, Value = true }; //onMouseOver.Setters.Add(new Setter { Property = GridSplitter.BackgroundProperty, Value = Brushes.Black }); //splitter.Triggers.Add(onMouseOver); //var onMouseOut = new Trigger { Property = GridSplitter.IsMouseOverProperty, Value = false }; //onMouseOut.Setters.Add(new Setter { Property = GridSplitter.BackgroundProperty, Value = Brushes.DarkGray }); //splitter.Triggers.Add(onMouseOut); GraphsGrid.Children.Add(splitter); rowIndex++; } } GraphsGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(18) }); if (TimeAxisGraph == null) { TimeAxisGraph = new Graph(Presentation) { DrawTimeAxis = true } } ; TimeAxisGraph.SetValue(Grid.RowProperty, rowIndex); TimeAxisGraph.SetValue(Grid.ColumnProperty, 0); GraphsGrid.Children.Add(TimeAxisGraph); }
internal void SplitViewHorizontally(IWpfTextView textView) { var tabInfo = ActiveTabInfo; var newTextViewHost = CreateTextViewHost(textView); var vimBuffer = _vimComponentHost.Vim.GetOrCreateVimBuffer(textView); tabInfo.AddViewInfo(vimBuffer, newTextViewHost); var viewInfoList = tabInfo.ViewInfoList.ToList(); var grid = BuildGrid(viewInfoList); var row = 0; for (int i = 0; i < viewInfoList.Count; i++) { var viewInfo = viewInfoList[i]; var textViewHost = viewInfo.TextViewHost; var control = textViewHost.HostControl; control.SetValue(Grid.RowProperty, row++); control.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(control); if (i + 1 < viewInfoList.Count) { var splitter = new GridSplitter(); splitter.ResizeDirection = GridResizeDirection.Rows; splitter.HorizontalAlignment = HorizontalAlignment.Stretch; splitter.VerticalAlignment = VerticalAlignment.Stretch; splitter.ShowsPreview = true; splitter.SetValue(Grid.RowProperty, row++); splitter.SetValue(Grid.ColumnProperty, 0); splitter.Height = 5; splitter.Background = Brushes.Black; grid.Children.Add(splitter); } } tabInfo.TabItem.Content = grid; }
private static void OnColumnsWithHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Grid grid = (Grid)d; var newList = (ObservableCollection <DatabaseColumnHeaderViewModel>)e.NewValue; void onChanged(object?sender, NotifyCollectionChangedEventArgs e) { grid.Children.Clear(); grid.ColumnDefinitions.Clear(); int index = 0; foreach (var column in newList) { var definition = new ColumnDefinition(); definition.Width = new GridLength(column.PreferredWidth ?? 120, GridUnitType.Pixel); definition.SharedSizeGroup = column.DatabaseName; definition.MinWidth = 30; grid.ColumnDefinitions.Add(definition); definition = new ColumnDefinition(); definition.Width = new GridLength(5, GridUnitType.Pixel); grid.ColumnDefinitions.Add(definition); var tb = new TextBlock() { Text = column.Name, Padding = new Thickness(16, 6, 6, 6) }; tb.SetValue(Grid.ColumnProperty, index * 2); tb.SetValue(ToolTip.ToolTipProperty, column.Help); grid.Children.Add(tb); var splitter = new GridSplitter() { }; splitter.HorizontalAlignment = HorizontalAlignment.Stretch; splitter.SetValue(Grid.ColumnProperty, index * 2 + 1); grid.Children.Add(splitter); index++; } grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(30, GridUnitType.Pixel) }); } newList.CollectionChanged += onChanged; onChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); }
private void LoadGridSplitter(int count) { Grids.RowDefinitions.Add(new RowDefinition { Height = new GridLength(3) }); var gridSplitter = new GridSplitter { ResizeDirection = GridResizeDirection.Rows, Height = 3, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(0), Background = SystemColors.ControlBrush }; Grids.Children.Add(gridSplitter); gridSplitter.SetValue(Grid.RowProperty, count); }
internal static GridSplitter CreateGridSplitterThroughCode(int? row, int? column, int? rowSpan, int? columnSpan, double? height, double? width, VerticalAlignment? vAlign, HorizontalAlignment? hAlign, Brush background, bool? showsPreview) { GridSplitter splitter = new GridSplitter(); if (row != null) { splitter.SetValue(Grid.RowProperty, (int)row); } if (column != null) { splitter.SetValue(Grid.ColumnProperty, (int)column); } if (rowSpan != null) { splitter.SetValue(Grid.RowSpanProperty, (int)rowSpan); } if (columnSpan != null) { splitter.SetValue(Grid.ColumnSpanProperty, (int)columnSpan); } if (height != null) { splitter.Height = (double)height; } if (width != null) { splitter.Width = (double)width; } if (background != null) { splitter.Background = background; } if (showsPreview != null) { splitter.ShowsPreview = (bool)showsPreview; } if (hAlign != null) { splitter.HorizontalAlignment = (HorizontalAlignment)hAlign; } if (vAlign != null) { splitter.VerticalAlignment = (VerticalAlignment)vAlign; } return splitter; }
/// <summary> /// Re-render the panels displayed from the selected panel collection. /// </summary> private void UpdatePanelsFromCollection(IPanelCollection panelCollection) { GridSplitter gridSplitter; System.Windows.Controls.MenuItem menuItem; // Prepare the Panels for Removal if (_selectedPanelCollection != null) { foreach (IRegisteredPanel nextPanel in _selectedPanelCollection.Panels) { // Notify them to Pause Monitoring nextPanel.PauseMonitoring(); // Unregister this MainWindow's event handlers from the Panel's events nextPanel.UnRegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_HIDE_PANEL, RemovePanelFromDisplay); nextPanel.UnRegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_SHOW_PANEL, AddPanelToDisplay); } } // Change Collections _selectedPanelCollection = panelCollection; // Clear out the Content Area ContentAreaGrid.Children.Clear(); ContentAreaGrid.RowDefinitions.Clear(); // Remove all menu items menAvailablePanels.Items.Clear(); // Build the Row Definitions for the Home Panels and Add the panels foreach (IRegisteredPanel nextPanel in _selectedPanelCollection.Panels) { // Add the panel to available panels menu menuItem = new System.Windows.Controls.MenuItem(); menuItem.Header = new Label() { Content = nextPanel.Title, Padding = new Thickness(0.0d) }; menuItem.IsCheckable = true; menuItem.IsChecked = nextPanel.IsShown; // Register the panel's event handlers to the MenuItem's events menuItem.Checked += nextPanel.ShowPanel; menuItem.Unchecked += nextPanel.HidePanel; // Register this MainWindow's event handlers to the Panel's events nextPanel.RegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_HIDE_PANEL, RemovePanelFromDisplay); nextPanel.RegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_SHOW_PANEL, AddPanelToDisplay); menAvailablePanels.Items.Add(menuItem); // Add the Panel to be displayed if (nextPanel.IsShown) { // Add the next panel ((UserControl)nextPanel).SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count); ((UserControl)nextPanel).SetValue(Grid.ColumnProperty, 0); ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); ContentAreaGrid.Children.Add((UserControl)nextPanel); // Unpause the next panel if (nextPanel.IsPaused) { nextPanel.UnPauseMonitoring(); } else { nextPanel.StartMonitoring(ELM327Connection.Connection); } // Add a GridSplitter gridSplitter = new GridSplitter() { Height = 4.0d, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 3, 0, 3), Background = new SolidColorBrush(Colors.Transparent) }; gridSplitter.SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count); gridSplitter.SetValue(Grid.ColumnProperty, 0); ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); ContentAreaGrid.Children.Add(gridSplitter); } } }
private void _initializeMainComponent() { /* メニューアイテムの描画 */ var titleBarArea = new ColumnDefinition { Width = new GridLength(400) }; var catchableArea = new ColumnDefinition(); CaptionBarArea.ColumnDefinitions.Add(titleBarArea); CaptionBarArea.ColumnDefinitions.Add(catchableArea); var menuArea = new MenuArea(); menuArea.SetValue(Grid.ColumnProperty, 0); CaptionBarArea.Children.Add(menuArea); // システムボタンの描画 CaptionBarArea.Children.Add(_systemButtons); /* メインコンテンツの描画 */ // グリッドの描画 var treeViewArea = new ColumnDefinition { MinWidth = 5, Width = new GridLength(300) }; var splitterArea = new ColumnDefinition { Width = new GridLength(4) }; var dragblzArea = new ColumnDefinition(); ContentArea.ColumnDefinitions.Add(treeViewArea); ContentArea.ColumnDefinitions.Add(splitterArea); ContentArea.ColumnDefinitions.Add(dragblzArea); // コンテンツの描画 var manageArea = new DatabaseTreeViewControl(); manageArea.SetValue(Grid.ColumnProperty, 0); var splitter = new GridSplitter { HorizontalAlignment = HorizontalAlignment.Stretch }; splitter.SetResourceReference(BackgroundProperty, "ThemeBrushKey"); splitter.SetValue(Grid.RowProperty, 1); splitter.SetValue(Grid.ColumnProperty, 1); var dragblzControl = new DragablzControl(); dragblzControl.SetValue(Grid.ColumnProperty, 2); ContentArea.Children.Add(manageArea); ContentArea.Children.Add(splitter); ContentArea.Children.Add(dragblzControl); dragblzControl.FormLoadEnded(); /* イベントのハンドル */ menuArea.newTab.Click += (_object, _e) => dragblzControl.AddServerAddPage(); initialized = true; }
private void InitializeComponent() { Grid grid = this; grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(5) }); grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(25) }); TextBox = new RichTextBox { FontFamily = new FontFamily("Consolas"), FontSize = 12, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; TextBox.Foreground = Themes.SqlEditor.Foreground; TextBox.Background = Themes.SqlEditor.Background; //Paragraph space Style style = new Style { TargetType = typeof(Paragraph) }; style.Setters.Add(new Setter { Property = Block.MarginProperty, Value = new Thickness(0) }); TextBox.Resources.Add(typeof(Paragraph), style); GridSplitter hSplitter = new GridSplitter { Height = 5, HorizontalAlignment = HorizontalAlignment.Stretch }; TabControl = new TabControl(); TabControl.Foreground = Themes.SqlEditor.Foreground; TabControl.Background = Themes.SqlEditor.Background; lblRowCount = new TextBlock { Width = 200, HorizontalAlignment = HorizontalAlignment.Right }; StatusBar statusBar = new StatusBar { Height = 20 }; statusBar.Items.Add(new StatusBarItem { Content = lblRowCount, HorizontalAlignment = HorizontalAlignment.Right }); TextBox.SetValue(Grid.RowProperty, 0); hSplitter.SetValue(Grid.RowProperty, 1); TabControl.SetValue(Grid.RowProperty, 2); statusBar.SetValue(Grid.RowProperty, 3); grid.Children.Add(TextBox); grid.Children.Add(hSplitter); grid.Children.Add(TabControl); grid.Children.Add(statusBar); }
private void InternalArrange(Grid grid, IPane pane) { if (pane is UIElement) { grid.Children.Add(pane as UIElement); } else if (pane is PaneGroup) { PaneGroup group = pane as PaneGroup; if (group.First.Hidden && !group.Second.Hidden) { InternalArrange(grid, group.Second); } else if (!group.First.Hidden && group.Second.Hidden) { InternalArrange(grid, group.First); } else { Grid firstGrid = new Grid(); Grid secondGrid = new Grid(); if (group.Split == SplitOrientation.Horizontal) { grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions[0].Height = group.First.GridHeight; grid.RowDefinitions[1].Height = group.Second.GridHeight; //if (!grid.RowDefinitions[0].Height.IsStar && // !grid.RowDefinitions[1].Height.IsStar) // grid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star); firstGrid.SetValue(Grid.ColumnProperty, 0); firstGrid.SetValue(Grid.RowProperty, 0); secondGrid.SetValue(Grid.ColumnProperty, 0); secondGrid.SetValue(Grid.RowProperty, 1); GridSplitter splitter = new GridSplitter(); splitter.VerticalAlignment = VerticalAlignment.Top; splitter.HorizontalAlignment = HorizontalAlignment.Stretch; splitter.SetValue(Grid.ColumnProperty, 0); splitter.SetValue(Grid.RowProperty, 1); splitter.Height = 5; secondGrid.Margin = new Thickness(0, 5, 0, 0); grid.Children.Add(firstGrid); grid.Children.Add(splitter); grid.Children.Add(secondGrid); InternalArrange(firstGrid, group.First); InternalArrange(secondGrid, group.Second); } else { grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.RowDefinitions.Add(new RowDefinition()); grid.ColumnDefinitions[0].Width = group.First.GridWidth; grid.ColumnDefinitions[1].Width = group.Second.GridWidth; if (!grid.ColumnDefinitions[0].Width.IsStar && !grid.ColumnDefinitions[1].Width.IsStar) { grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star); } firstGrid.SetValue(Grid.ColumnProperty, 0); firstGrid.SetValue(Grid.RowProperty, 0); secondGrid.SetValue(Grid.ColumnProperty, 1); secondGrid.SetValue(Grid.RowProperty, 0); GridSplitter splitter = new GridSplitter(); splitter.VerticalAlignment = VerticalAlignment.Stretch; splitter.HorizontalAlignment = HorizontalAlignment.Left; splitter.SetValue(Grid.ColumnProperty, 1); splitter.SetValue(Grid.RowProperty, 0); splitter.Width = 5; secondGrid.Margin = new Thickness(5, 0, 0, 0); grid.Children.Add(firstGrid); grid.Children.Add(splitter); grid.Children.Add(secondGrid); InternalArrange(firstGrid, group.First); InternalArrange(secondGrid, group.Second); } } } }
public static async Task <CustomWebAuthenticationResult> AuthenticateAsync( WebAuthenticationOptions options, Uri requestUri, Uri callbackUri, bool showUrl) { if (options != WebAuthenticationOptions.None) { throw new ArgumentException("WebAuthenticationBroker currently only supports WebAuthenticationOptions.None", "options"); } redirectUri = callbackUri; dialog = new ContentDialog(); var grid = new Grid { VerticalAlignment = VerticalAlignment.Center }; grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(0.1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); var label = new TextBlock { Text = "Connect to a service", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0) }; grid.Children.Add(label); var closeButton = new Button { Content = "", FontFamily = new FontFamily("Segoe UI Symbol"), BorderBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), Margin = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center }; closeButton.Click += (s, e) => { dialog.Hide(); }; grid.Children.Add(closeButton); _address = new TextBox { Text = string.Empty, Margin = new Thickness(0, 5, 0, 5), IsReadOnly = true, TextWrapping = TextWrapping.Wrap, FontSize = 12, }; _address.SetValue(Grid.RowProperty, 1); if (showUrl) { grid.Children.Add(_address); var splitter = new GridSplitter(); splitter.SetValue(Grid.RowProperty, 2); splitter.Element = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, IsHitTestVisible = false, VerticalAlignment = VerticalAlignment.Center, Text = "\uE76F", Foreground = new SolidColorBrush(Colors.White), FontFamily = new FontFamily("Segoe MDL2 Assets") }; grid.Children.Add(splitter); } var webView = new WebView(WebViewExecutionMode.SameThread) { Source = requestUri }; webView.NavigationStarting += WebView_NavigationStarting; webView.NavigationFailed += WebView_NavigationFailed; webView.ContentLoading += (sender, args) => { _address.Text = args.Uri.ToString(); }; webView.MinWidth = 460; webView.MinHeight = 600; var scrollViewer = new ScrollViewer { HorizontalAlignment = HorizontalAlignment.Stretch, Content = webView }; scrollViewer.SetValue(Grid.RowProperty, 3); grid.Children.Add(scrollViewer); dialog.Content = grid; //dialog.GotFocus += (s, e) => { webView.Focus(Windows.UI.Xaml.FocusState.Programmatic); }; var res = await dialog.ShowAsync(); return(new CustomWebAuthenticationResult(code, errorCode, errorCode > 0 ? CustomWebAuthenticationStatus.ErrorHttp : string.IsNullOrEmpty(code) ? CustomWebAuthenticationStatus.UserCancel : CustomWebAuthenticationStatus.Success)); }
void UpdateGrid(bool horizontal) { grid.Children.Clear(); grid.ColumnDefinitions.Clear(); grid.RowDefinitions.Clear(); // Make sure the horizontal grid splitters can resize the content double d = 0.05; bool needSplitter = false; if (!horizontal) { grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); int rowCol = 0; foreach (var info in children) { if (needSplitter && !info.LengthInfo.Vertical.GridLength.Value.IsAuto) { var gridSplitter = new GridSplitter(); Panel.SetZIndex(gridSplitter, 1); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(splitterLength, GridUnitType.Pixel) }); gridSplitter.SetValue(Grid.RowProperty, rowCol); gridSplitter.Margin = new Thickness(0, -5, 0, -5); gridSplitter.BorderThickness = new Thickness(0, 5, 0, 5); gridSplitter.HorizontalAlignment = HorizontalAlignment.Stretch; gridSplitter.VerticalAlignment = VerticalAlignment.Center; gridSplitter.Focusable = false; gridSplitter.BorderBrush = Brushes.Transparent; grid.Children.Add(gridSplitter); rowCol++; } var rowDef = new RowDefinition() { Height = GetGridLength(info.LengthInfo.Vertical.GridLength.Value, -d) }; if (info.LengthInfo.Vertical.MaxLength != null) { rowDef.MaxHeight = info.LengthInfo.Vertical.MaxLength.Value; } if (info.LengthInfo.Vertical.MinLength != null) { rowDef.MinHeight = info.LengthInfo.Vertical.MinLength.Value; } grid.RowDefinitions.Add(rowDef); var uiel = GetUIElement(info.Child); uiel.SetValue(Grid.RowProperty, rowCol); uiel.ClearValue(Grid.ColumnProperty); grid.Children.Add(uiel); rowCol++; d = -d; needSplitter = !info.LengthInfo.Vertical.GridLength.Value.IsAuto; } } else { grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); int rowCol = 0; foreach (var info in children) { if (needSplitter && !info.LengthInfo.Horizontal.GridLength.Value.IsAuto) { var gridSplitter = new GridSplitter(); Panel.SetZIndex(gridSplitter, 1); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(splitterLength, GridUnitType.Pixel) }); gridSplitter.SetValue(Grid.ColumnProperty, rowCol); gridSplitter.Margin = new Thickness(-5, 0, -5, 0); gridSplitter.BorderThickness = new Thickness(5, 0, 5, 0); gridSplitter.HorizontalAlignment = HorizontalAlignment.Center; gridSplitter.VerticalAlignment = VerticalAlignment.Stretch; gridSplitter.Focusable = false; gridSplitter.BorderBrush = Brushes.Transparent; grid.Children.Add(gridSplitter); rowCol++; } var colDef = new ColumnDefinition() { Width = GetGridLength(info.LengthInfo.Horizontal.GridLength.Value, -d) }; if (info.LengthInfo.Horizontal.MaxLength != null) { colDef.MaxWidth = info.LengthInfo.Horizontal.MaxLength.Value; } if (info.LengthInfo.Horizontal.MinLength != null) { colDef.MinWidth = info.LengthInfo.Horizontal.MinLength.Value; } this.grid.ColumnDefinitions.Add(colDef); var uiel = GetUIElement(info.Child); uiel.ClearValue(Grid.RowProperty); uiel.SetValue(Grid.ColumnProperty, rowCol); grid.Children.Add(uiel); rowCol++; d = -d; needSplitter = !info.LengthInfo.Horizontal.GridLength.Value.IsAuto; } } }
public void VariableNumbersOfColumnsAndRows() { // Check the cases where a vertical GridSplitter is used in a Grid with 0,1, and n columns // and when a horizontal GridSplitter is used in a Grid with 0,1, and n rows. bool result; Grid g = CreateGrid(2, 0, 100.0, 100.0); GridSplitter splitter = CreateGridSplitterThroughCode(1, 0, null, null, null, null, VerticalAlignment.Top, HorizontalAlignment.Stretch, null, true); g.Children.Add(splitter); this.CreateAsyncTest(g, delegate { result = GridSplitter.DoubleUtil.AreClose(g.RowDefinitions[0].ActualHeight, 50.0); Assert.IsTrue(result, "ActualHeight should be same as the desired height."); }, () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(0.0, 10.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(0.0, 0.0, false)), delegate { result = GridSplitter.DoubleUtil.AreClose(g.RowDefinitions[0].ActualHeight, 60.0); Assert.IsTrue(result, "ActualHeight should be same as the desired height."); }, () => g.ColumnDefinitions.Add(new ColumnDefinition()), () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(0.0, -15.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(0.0, 0.0, false)), delegate { result = GridSplitter.DoubleUtil.AreClose(g.RowDefinitions[0].ActualHeight, 45.0); Assert.IsTrue(result, "ActualHeight should be same as the desired height."); }, () => g.ColumnDefinitions.Add(new ColumnDefinition()), () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(0.0, 25.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(0.0, 0.0, false)), delegate { result = GridSplitter.DoubleUtil.AreClose(g.RowDefinitions[0].ActualHeight, 70.0); Assert.IsTrue(result, "ActualHeight should be same as the desired height."); }, () => g.RowDefinitions.Clear(), () => splitter.VerticalAlignment = VerticalAlignment.Stretch, () => splitter.HorizontalAlignment = HorizontalAlignment.Left, () => splitter.SetValue(Grid.RowProperty, 0), () => splitter.SetValue(Grid.ColumnProperty, 1), delegate { result = GridSplitter.DoubleUtil.AreClose(g.ColumnDefinitions[0].ActualWidth, 50.0); Assert.IsTrue(result, "ActualWidth should be same as the desired width."); }, () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(10.0, 0.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(0.0, 0.0, false)), delegate { result = GridSplitter.DoubleUtil.AreClose(g.ColumnDefinitions[0].ActualWidth, 60.0); Assert.IsTrue(result, "ActualWidth should be same as the desired width."); }, () => g.RowDefinitions.Add(new RowDefinition()), () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(-15.0, 0.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(0.0, 0.0, false)), delegate { result = GridSplitter.DoubleUtil.AreClose(g.ColumnDefinitions[0].ActualWidth, 45.0); Assert.IsTrue(result, "ActualWidth should be same as the desired width."); }, () => g.RowDefinitions.Add(new RowDefinition()), () => splitter.DragValidator_DragStartedEvent(splitter, new DragStartedEventArgs(0.0, 0.0)), () => splitter.DragValidator_DragDeltaEvent(splitter, new DragDeltaEventArgs(25.0, 0.0)), () => splitter.DragValidator_DragCompletedEvent(splitter, new DragCompletedEventArgs(0.0, 0.0, false)), delegate { result = GridSplitter.DoubleUtil.AreClose(g.ColumnDefinitions[0].ActualWidth, 70.0); Assert.IsTrue(result, "ActualWidth should be same as the desired width."); }); }
static GridColumnsBinder() { ColumnsProperty.Changed.SubscribeAction(ev => { if (ev.Sender is not Grid grid) { return; } var newList = ev.NewValue.Value; if (newList == null) { return; } grid.ColumnDefinitions.Clear(); foreach (var column in newList) { var definition = new ColumnDefinition(); definition.SharedSizeGroup = column.DatabaseName; grid.ColumnDefinitions.Add(definition); definition = new ColumnDefinition(5, GridUnitType.Pixel); grid.ColumnDefinitions.Add(definition); } }); ColumnsWithHeaderProperty.Changed.SubscribeAction(ev => { if (ev.Sender is not Grid grid) { return; } var newList = ev.NewValue.Value; if (newList == null) { return; } void onChanged(object?sender, NotifyCollectionChangedEventArgs e) { grid.Children.Clear(); grid.ColumnDefinitions.Clear(); int index = 0; foreach (var column in newList) { var definition = new ColumnDefinition(column.PreferredWidth ?? 120, GridUnitType.Pixel); definition.SharedSizeGroup = column.DatabaseName; definition.MinWidth = 30; grid.ColumnDefinitions.Add(definition); definition = new ColumnDefinition(5, GridUnitType.Pixel); grid.ColumnDefinitions.Add(definition); var tb = new TextBlock() { Text = column.Name }; tb.SetValue(Grid.ColumnProperty, index * 2); tb.SetValue(ToolTip.TipProperty, column.Help); grid.Children.Add(tb); var splitter = new GridSplitter() { }; splitter.SetValue(Grid.ColumnProperty, index * 2 + 1); grid.Children.Add(splitter); index++; } grid.ColumnDefinitions.Add(new ColumnDefinition(30, GridUnitType.Pixel)); } newList.CollectionChanged += onChanged; onChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); }); }
public static List <Border> SplitScreen(Point pStartRowColumn, Point pOverRowColumn, Grid gAllSlideBox, ResourceDictionary rdDirectory) { List <Border> list = new List <Border>(); pStartRowColumn.X *= 2.0; pStartRowColumn.Y *= 2.0; pOverRowColumn.X *= 2.0; pOverRowColumn.Y *= 2.0; int num; int num2; if (pStartRowColumn.X < pOverRowColumn.X) { num = (int)pStartRowColumn.X; num2 = (int)pOverRowColumn.X; } else { num = (int)pOverRowColumn.X; num2 = (int)pStartRowColumn.X; } int num3; int num4; if (pStartRowColumn.Y < (double)(int)pOverRowColumn.Y) { num3 = (int)pStartRowColumn.Y; num4 = (int)pOverRowColumn.Y; } else { num3 = (int)pOverRowColumn.Y; num4 = (int)pStartRowColumn.Y; } Dictionary <Point, Border> dictionary = new Dictionary <Point, Border>(); foreach (FrameworkElement child in gAllSlideBox.Children) { if (child is Border) { int row = Grid.GetRow(child); int column = Grid.GetColumn(child); if (num <= row && row <= num2 && num3 <= column && column <= num4) { dictionary.Add(new Point(row - num, column - num3), (Border)child); } } } ClearSplitScreen(gAllSlideBox); int num5 = Math.Abs((int)(pStartRowColumn.X - pOverRowColumn.X)); int num6 = Math.Abs((int)(pStartRowColumn.Y - pOverRowColumn.Y)); for (int i = 0; i <= num5; i++) { RowDefinition rowDefinition = new RowDefinition(); gAllSlideBox.RowDefinitions.Add(rowDefinition); if (i % 2 == 1) { GridSplitter gridSplitter = new GridSplitter(); gridSplitter.SetValue(FrameworkElement.StyleProperty, rdDirectory["HorGridSplitter"]); Grid.SetRow(gridSplitter, i); Grid.SetColumnSpan(gridSplitter, num6 + 1); gAllSlideBox.Children.Add(gridSplitter); rowDefinition.SetValue(FrameworkElement.StyleProperty, rdDirectory["SplitterRow"]); } else { rowDefinition.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideRow"]); } } for (int j = 0; j <= num6; j++) { ColumnDefinition columnDefinition = new ColumnDefinition(); gAllSlideBox.ColumnDefinitions.Add(columnDefinition); if (j % 2 == 1) { GridSplitter gridSplitter2 = new GridSplitter(); gridSplitter2.SetValue(FrameworkElement.StyleProperty, rdDirectory["VerGridSplitter"]); Grid.SetColumn(gridSplitter2, j); Grid.SetRowSpan(gridSplitter2, num5 + 1); gAllSlideBox.Children.Add(gridSplitter2); columnDefinition.SetValue(FrameworkElement.StyleProperty, rdDirectory["SplitterColumn"]); } else { columnDefinition.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideColumn"]); } } for (int k = 0; k <= num5; k++) { if (k % 2 == 1) { continue; } for (int l = 0; l <= num6; l++) { if (l % 2 == 1) { continue; } Point key = new Point(k, l); Border border; if (dictionary.ContainsKey(key)) { border = dictionary[key]; if (num5 == 0 && num6 == 0) { RemoveActiveStyle(border.Child as Grid); } } else { border = CreateSlideBox(rdDirectory); list.Add(border); } Grid.SetRow(border, k); Grid.SetColumn(border, l); gAllSlideBox.Children.Add(border); } } dictionary.Clear(); return(list); }
private void Redraw() { var properties = TypeDescriptor.GetProperties(viewModel.CollectionElementType).OfType <PropertyDescriptor>().Where(x => x.Attributes.OfType <ConfigurationPropertyAttribute>().Any()).ToArray(); for (int n = 0; n <= viewModel.ChildElements.Count() + 1; n++) { Collection.RowDefinitions.Add(new RowDefinition()); } int i = 0; foreach (var property in properties) { var label = new Label() { Content = property.DisplayName }; Collection.Children.Add(label); label.SetValue(Grid.RowProperty, 0); label.SetValue(Grid.ColumnProperty, i); var gridSplitter = new GridSplitter() { Width = 2, HorizontalAlignment = HorizontalAlignment.Right }; Collection.Children.Add(gridSplitter); gridSplitter.Focusable = false; gridSplitter.SetValue(Grid.RowProperty, 0); gridSplitter.SetValue(Grid.ColumnProperty, i); gridSplitter.SetValue(Grid.RowSpanProperty, viewModel.ChildElements.Count() + 1); i++; } ContextMenuButton addButton = new ContextMenuButton(); Collection.Children.Add(addButton); CommandModel addCommand = viewModel.AddCommands.First(); addButton.Command = addCommand; addButton.SetValue(Grid.RowProperty, 0); addButton.SetValue(Grid.ColumnProperty, i); addButton.Style = FindResource("ContextAdderButtonMenuStyle") as Style; addButton.VerticalAlignment = VerticalAlignment.Center; addButton.SetValue(AutomationProperties.AutomationIdProperty, addCommand.Title); int j = 1; foreach (var element in viewModel.ChildElements) { i = 0; foreach (var propertyDescriptor in properties) { var property = element.Property(propertyDescriptor.Name); ContentControl contentControl = new ContentControl(); contentControl.Focusable = false; Collection.Children.Add(contentControl); contentControl.SetValue(ContentControl.ContentProperty, property.BindableProperty); contentControl.SetValue(Grid.RowProperty, j); contentControl.SetValue(Grid.ColumnProperty, i); i++; } Button deleteButton = new Button(); Collection.Children.Add(deleteButton); CommandModel deleteCommand = element.Commands.Where(x => x.Placement == CommandPlacement.ContextDelete).First(); deleteButton.Command = deleteCommand; deleteButton.SetValue(Grid.RowProperty, j); deleteButton.SetValue(Grid.ColumnProperty, i); deleteButton.Style = FindResource("DeleteButtonStyle") as Style; deleteButton.VerticalAlignment = VerticalAlignment.Center; deleteButton.SetValue(AutomationProperties.AutomationIdProperty, deleteCommand.Title); j++; } }
public TabContentView(SqlConnection conn) { _conn = conn; var grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); var subGrid = new Grid(); subGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); subGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(5, GridUnitType.Pixel) }); _bottomRowDef = new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }; subGrid.RowDefinitions.Add(_bottomRowDef); _avEdit = new TextEditor() { FontFamily = new FontFamily("Consalas"), FontSize = 16, HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden, WordWrap = true, VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; _avEdit.SetValue(Grid.RowProperty, 0); _avEdit.Loaded += _avEdit_Loaded; _avEdit.SyntaxHighlighting = HIGHLIGHTING_DEF; this.KeyUp += TabContentView_KeyUp; subGrid.Children.Add(_avEdit); _splitter = new GridSplitter { HorizontalAlignment = HorizontalAlignment.Stretch, Style = COLLAPSE_STYLE }; _splitter.SetValue(Grid.RowProperty, 1); subGrid.Children.Add(_splitter); _panel = new DockPanel(); _panel.SetValue(Grid.RowProperty, 2); _dataGrid = new DataGrid { //MaxHeight = 500, Style = COLLAPSE_STYLE, EnableColumnVirtualization = true, EnableRowVirtualization = true, AutoGenerateColumns = false }; _dataGrid.IsReadOnly = true; _panel.Children.Add(_dataGrid); _errorLabel = new Label(); _errorLabel.Style = COLLAPSE_STYLE; _panel.Children.Add(_errorLabel); subGrid.Children.Add(_panel); grid.Children.Add(subGrid); _statusBar = new ConnectionStatusBar(_conn); _statusBar.SetValue(Grid.RowProperty, 1); grid.Children.Add(_statusBar); this.Content = grid; InitializeTextMarkerService(); }