예제 #1
0
        private static void OnAutoSizeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            var column = (ColumnBase)obj;

            if ((bool)e.NewValue)
            {
                column.PropertyChanged += column_PropertyChanged;
                if (column.DataGridControl != null)
                {
                    string valuePath = GetValuePath(column);
                    if (valuePath != null)
                    {
                        SetWidthToFit(column);
                        ItemPropertyChangedListener.Subscribe(column, column.DataGridControl.Items, valuePath, DataGridControl_ItemsChanged);
                    }
                }
            }
            else
            {
                column.PropertyChanged -= column_PropertyChanged;
                if (column.DataGridControl != null)
                {
                    ItemPropertyChangedListener.Unsubscribe(column);
                }
            }
        }
예제 #2
0
        private static void OnAutoSizeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            var comboBox = (ComboBox)obj;

            if ((bool)e.NewValue)
            {
                SetWidthToFit(comboBox);
                ItemPropertyChangedListener.Subscribe(comboBox, comboBox.Items, comboBox.DisplayMemberPath, ComboBox_ItemsChanged);
            }
            else
            {
                ItemPropertyChangedListener.Unsubscribe(comboBox);
            }
        }
예제 #3
0
 private static void column_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "DataGridControl")
     {
         var column = (ColumnBase)sender;
         if (column.DataGridControl != null)
         {
             string valuePath = GetValuePath(column);
             if (valuePath != null)
             {
                 SetWidthToFit(column);
                 ItemPropertyChangedListener.Subscribe(column, column.DataGridControl.Items, valuePath, DataGridControl_ItemsChanged);
             }
         }
         else
         {
             ItemPropertyChangedListener.Unsubscribe(column);
         }
     }
 }