/// <summary> /// Adds controls comprising the current view to the container of the view. /// The view will be visible immediately. /// </summary> internal override void Reveal() { _gridContainer = ViewContainer.Children.AddAndReference(UITheme.CreateGrid()); Grid.SetRow(_gridContainer, 0); //In case we are contained in a grid which has more rows and columns Grid.SetColumn(_gridContainer, 0); #region Define as many rows as there are logical row items in your view _gridContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); _gridContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); #endregion _treeView = _gridContainer.AddGridItem(0, new TreeView()); FillTreeWithEnlistmentData(); #region Tag editor view if (ShowTagEditorView) { var tagEditorViewContainer = _gridContainer.AddGridItem(1, UITheme.CreateGrid()); _tagEditorViewHandler = ViewFactory.CreateView(ViewType.TagEditorView, tagEditorViewContainer, Configuration) as TagEditorViewHandler; _tagEditorViewHandler.ApplyTagToSelectionEvent += ApplyTagToSelection; _tagEditorViewHandler.Reveal(); } #endregion }
/// <summary> /// Adds controls comprising the current view to the container of the view. /// The view will be visible immediately. /// </summary> internal override void Reveal() { #region Define as many rows as there are logical row items in your view ViewContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); ViewContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); ViewContainer.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); //Checks ViewContainer.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) }); //Enlistment #endregion var checkViewContainer = ViewContainer.AddGridItem(0, UITheme.CreateGrid()); Grid.SetColumn(checkViewContainer, 0); checkViewContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); //Checks view (tree and buttons) checkViewContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); //Check filter section _checksViewHandler = ViewFactory.CreateView(ViewType.ViewOnChecksWithFilter, checkViewContainer, Configuration) as ViewOnChecksWithFilterHandler; _checksViewHandler.ShowTagEditorView = false; _checksViewHandler.Reveal(); var rowOfButtonsToSelectOrUnselectAllChecks = checkViewContainer.Children.AddAndReference(new StackPanel { Orientation = Orientation.Horizontal }); Grid.SetRow(rowOfButtonsToSelectOrUnselectAllChecks, 1); Grid.SetColumn(rowOfButtonsToSelectOrUnselectAllChecks, 0); var selectAllFilteredChecks = rowOfButtonsToSelectOrUnselectAllChecks.Children.AddAndReference(UITheme.CreateButton("Select all")); selectAllFilteredChecks.Click += ReactionToClickingOnSelectAllFilteredChecks; var unselectAllFilteredChecks = rowOfButtonsToSelectOrUnselectAllChecks.Children.AddAndReference(UITheme.CreateButton("Clear selection")); unselectAllFilteredChecks.Click += ReactionToClickingOnUnselectFilteredChecks; #region Right side with the view on enlistment. var containerOfEnlistmentView = ViewContainer.AddGridItem(0, UITheme.CreateGrid()); Grid.SetColumn(containerOfEnlistmentView, 1); _enlistmentViewHandler = ViewFactory.CreateView(ViewType.ViewOnEnlistment, containerOfEnlistmentView, Configuration) as ViewOnEnlistmentHandler; _enlistmentViewHandler.ShowTagEditorView = false; _enlistmentViewHandler.Reveal(); #endregion #region Final 'Apply' button. It has to be in a panel or else it will stretch across the entire grid's column. var panelForApplyButton = ViewContainer.AddGridItem(1, new StackPanel { Orientation = Orientation.Horizontal }); var applyButton = panelForApplyButton.Children.AddAndReference(UITheme.CreateButton("Apply to enlistment selection")); applyButton.Click += ReactionToApplyButtonClick; #endregion }
/// <summary> /// Adds controls comprising the current view to the container of the view. /// The view will be visible immediately. /// </summary> internal override void Reveal() { _gridContainer = ViewContainer.Children.AddAndReference(UITheme.CreateGrid()); #region Define as many rows as there are logical row items in your view _gridContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); _gridContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); _gridContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); _gridContainer.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); #endregion _treeView = _gridContainer.AddGridItem(0, new TreeView()); FillTreeWithEnlistmentData(); #region Tag editor view var tagEditorViewContainer = _gridContainer.AddGridItem(2, UITheme.CreateGrid()); _tagEditorViewHandler = new TagEditorViewHandler(tagEditorViewContainer, Configuration); _tagEditorViewHandler.ApplyTagToSelectionEvent += ApplyTagToSelection; _tagEditorViewHandler.Reveal(); #endregion #region Filter var projectFilterPanel = _gridContainer.AddGridItem(3, new StackPanel { Orientation = Orientation.Horizontal }); projectFilterPanel.Children.Add(new Label { Content = "Filter:" }); _FilterTextBox = projectFilterPanel.Children.AddAndReference(new TextBox { MinWidth = 120, MaxWidth = 120 }); _FilterTextBox.TextChanged += delegate { UpdateViewToMatchData(); }; projectFilterPanel.Children.AddAndReference(UITheme.CreateButton("Clear filter")).Click += delegate { _FilterTextBox.Clear(); }; #endregion }
/// <summary> /// Adds controls comprising the current view to the container of the view. /// The view will be visible immediately. /// </summary> internal override void Reveal() { LeftSideView = ViewContainer.AddGridItem(0, 0, UITheme.CreateGrid()); LeftSideView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); //Language groups label LeftSideView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); //Language groups control LeftSideView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); //Language groups label LeftSideView.AddGridItem(0, new Label { Content = "Select a language group to configure" }); LanguageGroupListView = LeftSideView.AddGridItem(1, new ListView()); LanguageGroupListView.SelectionChanged += LanguageGroupListSelectionChanged; TAGVIEWCONTAINER = LeftSideView.AddGridItem(2, 0, UITheme.CreateGrid()); TAGEDITORVIEW = (TagEditorViewHandler)ViewFactory.CreateView(ViewType.TagEditorView, TAGVIEWCONTAINER, Configuration); TAGEDITORVIEW.Reveal(); TAGEDITORVIEW.SaveTagEvent += savedTag => UpdateViewToMatchData(); RightSideView = ViewContainer.AddGridItem(0, 1, UITheme.CreateGrid()); IsRightSideEnabled = false; RightSideView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); //Languages label RightSideView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }); //Languages control AddLanguagesHeader(RightSideView, 0); LanguagesList = RightSideView.AddGridItem(1, new ListView()); AddContent(LanguagesList, Configuration.GetAllLanguages(), ContextType.Language); FillWithConfigurationData(); }
/// <summary> /// Embeds the header over languages control (tree view) in the specified row. /// </summary> /// <param name="container">Container grid that will contain the header.</param> /// <param name="containerRow">Row in the parent container, where the header should be placed.</param> private void AddLanguagesHeader(Grid container, int containerRow) { var x = container.AddGridItem(containerRow, UITheme.CreateGrid()); x.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0, GridUnitType.Auto) }); x.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); var label = x.Children.AddAndReference(new Label { Content = "Languages belonging to the selected language group" }); Grid.SetColumn(label, 0); CheckBoxAllLanguages = x.Children.AddAndReference(new CheckBox { Content = "All", IsThreeState = true, VerticalAlignment = VerticalAlignment.Center }); Grid.SetColumn(CheckBoxAllLanguages, 1); CheckBoxAllLanguages.Click += CheckBoxAllLanguagesClicked; }