/// <summary> /// Initialise la grille2. /// </summary> protected void initializeItemsGrid() { itemsGrid = new BrowserGrid(); itemsGrid.hideContextMenu(); var gridFactory = new FrameworkElementFactory(typeof(Grid)); DataTemplate template = new DataTemplate(); template.VisualTree = gridFactory; itemsGrid.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()); itemsGrid.AlternatingRowBackground = bruch; itemsGrid.AlternatingRowBackground.Opacity = 0.3; for (int i = 0; i < 4; i++) { DataGridColumn column = getColumnAt(i); column.Header = getColumnHeader2At(i); column.Width = getColumnWidthAt(i); if (column is DataGridBoundColumn) { ((DataGridBoundColumn)column).Binding = getBinding2At(i); } itemsGrid.Columns.Add(column); } this.GridScrollPanel2.Content = itemsGrid; }
private void InitializeValuesGrid() { ValuesGrid = new BrowserGrid(); ValuesGrid.FilterHandler.Handler -= ValuesGrid.OnFilter; ValuesGrid.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; ValuesGrid.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()); ValuesGrid.AlternatingRowBackground = bruch; ValuesGrid.AlternatingRowBackground.Opacity = 0.3; DataGridTextColumn column = new DataGridTextColumn(); column.Header = "Values"; column.Width = new DataGridLength(1, DataGridLengthUnitType.Star); column.Binding = new System.Windows.Data.Binding("name"); ValuesGrid.Columns.Add(column); ValuesGrid.SelectionChanged += onSelectionChanged; }
/// <summary> /// Initialise la grille. /// </summary> protected void initializeGrid() { grid = new BrowserGrid(); grid.hideContextMenu(); grid.Sorting += OnSort; var gridFactory = new FrameworkElementFactory(typeof(Grid)); 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); } this.GridScrollPanel.Content = grid; this.grid.PreviewMouseLeftButtonDown += OnSelectionChange; this.PaginationPanel.GotoFirstPageButton.Click += OnGotoFirstPage; this.PaginationPanel.GotoPreviousPageButton.Click += OnGotoPreviousPage; this.PaginationPanel.GotoNextPageButton.Click += OnGotoNextPage; this.PaginationPanel.GotoLastPageButton.Click += OnGotoLastPage; }
/// <summary> /// Initialise la grille. /// </summary> protected void initializeGrid() { grid = new BrowserGrid(); grid.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; 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); } this.GridPanel.Content = grid; }