/// <summary> /// contains the recipe that says that each UI interface in this app must have a header, /// a mainContent and a footer, /// the content of this elements can vary but their locations and dimensions must be always the same /// header is located on the top of the page /// footer is located on the bottom of the page /// body is located between header and footer /// </summary> public GenericUI() : base() { this.VerticalAlignment = System.Windows.VerticalAlignment.Top; _header = GetHeader(); _footer = GetFooter(); _content = GetMainContent(); _content.HorizontalAlignment = HorizontalAlignment.Stretch; _content.VerticalAlignment = VerticalAlignment.Stretch; _content.OnPageContentChange += new CustomUserControl.ChangePageContentHandler(ChangePageContent); _content.OnWindowLayoutChange += new CustomUserControl.ChangeWindowLayoutHandler(ChangeWindowLayout); _header.OnWindowLayoutChange += new CustomUserControl.ChangeWindowLayoutHandler(ChangeWindowLayout); this.RowDefinitions.Add(new RowDefinition()); this.RowDefinitions.Add(new RowDefinition()); this.RowDefinitions.Add(new RowDefinition()); this.RowDefinitions[0].Height = new GridLength(50); this.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star); this.RowDefinitions[2].Height = new GridLength(30); Grid.SetRow(_header, 0); Grid.SetColumn(_header, 0); Grid.SetRow(_content, 1); Grid.SetColumn(_content, 0); Grid.SetRow(_footer, 2); Grid.SetColumn(_footer, 0); this.Children.Add(_header); this.Children.Add(_content); this.Children.Add(_footer); }
/// <summary> /// <param name="comp">comp an object of type CustomUserControl which will be set as the new body of the page </param> /// </summary> public void RaiseChangePageContentEvent(CustomUserControl comp) { if (OnPageContentChange == null) { return; } OnPageContentChange(this, new PageContentEventArgs(comp)); }
/// <summary> /// <param name="comp">comp an object of type CustomUserControl which will be set as the new body of the page </param> /// </summary> public void RaiseChangePageContentEvent(CustomUserControl comp) { if (OnPageContentChange == null) return; OnPageContentChange(this, new PageContentEventArgs(comp)); }
public PageContentEventArgs(CustomUserControl component) { ArgPageContent = component; }