Beispiel #1
0
        private static void Columns_CollectionChanged([NotNull, ItemNotNull] DataGridColumnStyleCollection styles, [NotNull] NotifyCollectionChangedEventArgs args)
        {
            Contract.Requires(styles != null);
            Contract.Requires(args != null);

            if (args.Action != NotifyCollectionChangedAction.Add)
            {
                return;
            }

            // ReSharper disable once PossibleNullReferenceException
            var column = (DataGridColumn)args.NewItems[0];

            // ReSharper disable once AssignNullToNotNullAttribute
            ApplyStyle(styles, column);
        }
Beispiel #2
0
 /// <summary>
 /// Sets the default column styles.
 /// </summary>
 /// <param name="dataGrid">The data grid.</param>
 /// <param name="value">The styles.</param>
 public static void SetDefaultColumnStyles(DataGrid dataGrid, DataGridColumnStyleCollection value)
 {
     Contract.Requires(dataGrid != null);
     dataGrid.SetValue(DefaultColumnStylesProperty, value);
 }
 /// <summary>
 /// Sets the default column styles.
 /// </summary>
 /// <param name="dataGrid">The data grid.</param>
 /// <param name="value">The styles.</param>
 public static void SetDefaultColumnStyles([NotNull] DataGrid dataGrid, [CanBeNull, ItemNotNull] DataGridColumnStyleCollection value)
 {
     dataGrid.SetValue(DefaultColumnStylesProperty, value);
 }