private static GridViewColumnCollectionBehaviour GetOrCreateColumnCollectionBehaviour(DependencyObject source) { GridViewColumnCollectionBehaviour behaviour = GetColumnCollectionBehaviour(source); if (behaviour == null) { GridView typedSource = source as GridView; if (typedSource == null) { throw new Exception("This property can only be set on controls deriving GridView"); } behaviour = new GridViewColumnCollectionBehaviour(typedSource); SetColumnCollectionBehaviour(typedSource, behaviour); } return(behaviour); }
public static void SetColumnCollectionBehaviour(DependencyObject obj, GridViewColumnCollectionBehaviour value) { obj.SetValue(ColumnCollectionBehaviourProperty, value); }