private void SendCommandToChild_Clicked(object sender, RoutedEventArgs e) { ButtonBase buttonBase = sender as ButtonBase; if (this.tabControl.Items != null && this.tabControl.Items.Count > 0) { var tabItem = this.tabControl.SelectedItem as TabItem; GraphicPanelControl graphicPanel = tabItem.Content as GraphicPanelControl; graphicPanel.ExecuteCommand(buttonBase.Name); } }
private void ResizeCanvas_SelectionChanged(object sender, SelectionChangedEventArgs e) { var mainVM = this.DataContext as DrawBoardViewModel; ButtonBase buttonBase = sender as ButtonBase; if (null != tabControl) { if (this.tabControl.Items != null && this.tabControl.Items.Count > 0) { var tabItem = this.tabControl.SelectedItem as TabItem; GraphicPanelControl graphicPanel = tabItem.Content as GraphicPanelControl; if (null != mainVM.SelectedCanvasSize) { graphicPanel.ExecuteCommand("ResizeCanvas", mainVM.SelectedCanvasSize.RatioValue); } } } }