public ProcessPopup() { InitializeComponent(); InitializeHandlers(); ItemsGrid = new BrowserGrid(); GridPanel.Content = ItemsGrid; }
private void InitializeExcelFilesGrid() { TableGrid = new BrowserGrid(); TableGrid.hideContextMenu(); var gridFactory = new FrameworkElementFactory(typeof(Grid)); var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox)); checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsSelected") { RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DataGridRow), 1) }); gridFactory.AppendChild(checkboxFactory); DataTemplate template = new DataTemplate(); template.VisualTree = gridFactory; TableGrid.RowHeaderTemplate = template; DataGridTextColumn column = new DataGridTextColumn(); column.Header = "Name"; column.Width = new DataGridLength(1, DataGridLengthUnitType.Star); column.Binding = new System.Windows.Data.Binding("name"); TableGrid.Columns.Add(column); var brushConverter = new System.Windows.Media.BrushConverter(); System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString()); TableGrid.AlternatingRowBackground = bruch; TableGrid.AlternatingRowBackground.Opacity = 0.3; this.GridPanel.Content = TableGrid; this.TableGrid.SelectionChanged += TableGrid_SelectionChanged; }
protected void InitializeGrid() { Grid = new BrowserGrid(); contextMenu = new BrowserGridContextMenu(); contextMenu.NewMenuItem.Visibility = System.Windows.Visibility.Collapsed; contextMenu.DeleteMenuItem.Visibility = System.Windows.Visibility.Collapsed; contextMenu.SaveAsMenuItem.Visibility = System.Windows.Visibility.Collapsed; contextMenu.RenameMenuItem.Visibility = System.Windows.Visibility.Collapsed; contextMenu.MenuSeparator.Visibility = System.Windows.Visibility.Collapsed; Grid.ContextMenu = contextMenu; var gridFactory = new FrameworkElementFactory(typeof(Grid)); var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox)); checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsSelected") { RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DataGridRow), 1) }); gridFactory.AppendChild(checkboxFactory); DataTemplate template = new DataTemplate(); template.VisualTree = gridFactory; Grid.RowHeaderTemplate = template; var brushConverter = new System.Windows.Media.BrushConverter(); System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString()); Grid.AlternatingRowBackground = bruch; Grid.AlternatingRowBackground.Opacity = 0.3; for (int i = 0; i < getColumnCount(); i++) { DataGridColumn column = getColumnAt(i); column.Header = getColumnHeaderAt(i); column.Width = getColumnWidthAt(i); column.CanUserResize = true; if (column is DataGridBoundColumn) { ((DataGridBoundColumn)column).Binding = getBindingAt(i); } Grid.Columns.Add(column); } this.Content = Grid; }
private void initializeGrid() { grid = new BrowserGrid(); var gridFactory = new FrameworkElementFactory(typeof(Grid)); var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox)); checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsSelected") { RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DataGridRow), 1) }); gridFactory.AppendChild(checkboxFactory); DataTemplate template = new DataTemplate(); template.VisualTree = gridFactory; grid.RowHeaderTemplate = template; var brushConverter = new System.Windows.Media.BrushConverter(); System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString()); grid.AlternatingRowBackground = bruch; grid.AlternatingRowBackground.Opacity = 0.3; for (int i = 0; i < getColumnCount(); i++) { DataGridColumn column = getColumnAt(i); column.Header = getColumnHeaderAt(i); column.Width = getColumnWidthAt(i); if (column is DataGridBoundColumn) { ((DataGridBoundColumn)column).Binding = getBindingAt(i); } grid.Columns.Add(column); } grid.SelectionChanged += onSelectionChanged; this.GridScrollPanel.Content = grid; }