private void clearViewClick(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; String name = menuItem.GetValue(MenuItem.NameProperty) as String; String[] splitedName = name.Split('_'); GridPanel gp = FindChild <GridPanel>(Application.Current.MainWindow, "grid_" + splitedName[1]); var grid = (Grid)gp.FindName("grid"); int rowSpan = (int)grid.GetValue(Grid.RowSpanProperty); int columnSpan = (int)grid.GetValue(Grid.ColumnSpanProperty); gp.Children.RemoveAt(gp.Children.Count - 1); menuItem.IsEnabled = false; ((MenuItem)buttonMenu.Items.GetItemAt(2)).IsEnabled = true; }
private void tableViewClick(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; String name = menuItem.GetValue(MenuItem.NameProperty) as String; String[] splitedName = name.Split('_'); GridPanel gp = FindChild <GridPanel>(Application.Current.MainWindow, "grid_" + splitedName[1]); var grid = (Grid)gp.FindName("grid"); DataTable table = new DataTable("Data history"); table.Columns.Add(new DataColumn("Kolona1")); table.Columns.Add(new DataColumn("Kolona2")); table.Rows.Add("Red1", "Red1"); table.Rows.Add("Red2", "Red2"); int rowSpan = (int)grid.GetValue(Grid.RowSpanProperty); int columnSpan = (int)grid.GetValue(Grid.ColumnSpanProperty); int row = (int)grid.GetValue(Grid.RowProperty); int column = (int)grid.GetValue(Grid.ColumnProperty); DataGrid dg = new DataGrid(); dg.ItemsSource = table.DefaultView; dg.IsReadOnly = true; dg.CanUserResizeColumns = true; dg.VerticalAlignment = VerticalAlignment.Stretch; dg.HorizontalAlignment = HorizontalAlignment.Stretch; dg.MaxWidth = 300; dg.MaxHeight = 300; //dg.HorizontalScrollBarVisibility = ; gp.Children.Add(dg); menuItem.IsEnabled = false; MenuItem clearView = new MenuItem(); clearView.Name = "clear_" + splitedName[1]; clearView.Header = "clear view"; clearView.Click += clearViewClick; buttonMenu.Items.Add(clearView); clearView.IsEnabled = true; }
public MainWindow() { InitializeComponent(); StartupWindow sp = new WpfApplication1.StartupWindow(); sp.ShowDialog(); if (sp.closed) { System.Windows.Application.Current.Shutdown(); } GridPanel gp = new GridPanel("1", 4, 4, 0, 0); //Setting data for column chart grid.Children.Add(gp); }
private void horizontal_split(object sender, RoutedEventArgs e) { //Button senderr = (Button)sender; GridPanel.horizontalSplitClick(sender, e); }