Пример #1
0
 private double GetMaxLength(DefinitionBase definition)
 {
     if (definition == null)
         return 0;
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.MaxWidth ?? ((RowDefinition) definition).MaxHeight;
 }
Пример #2
0
 private double GetActualLength(DefinitionBase definition)
 {
     if (definition == null)
         return 0;
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.ActualWidth ?? ((RowDefinition) definition).ActualHeight;
 }
Пример #3
0
 protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
 {
     base.OnAttachedToVisualTree(e);
     _grid = this.GetVisualParent<Grid>();
     
     if (Orientation == Orientation.Vertical)
     {
         Cursor = new Cursor(StandardCursorType.SizeWestEast);
         var col = GetValue(Grid.ColumnProperty);
         _definitions = _grid.ColumnDefinitions.Cast<DefinitionBase>().ToList();
         _prevDefinition = _definitions[col - 1];
         _nextDefinition = _definitions[col + 1];
     }
     else
     {
         Cursor = new Cursor(StandardCursorType.SizeNorthSouth);
         var row = GetValue(Grid.RowProperty);
         _definitions = _grid.RowDefinitions.Cast<DefinitionBase>().ToList();
         _prevDefinition = _definitions[row - 1];
         _nextDefinition = _definitions[row + 1];
     }
 }
Пример #4
0
 private void SetLengthInStars(DefinitionBase definition, double value)
 {
     var columnDefinition = definition as ColumnDefinition;
     if (columnDefinition != null)
     {
         columnDefinition.Width = new GridLength(value, GridUnitType.Star);
     }
     else
     {
         ((RowDefinition)definition).Height = new GridLength(value, GridUnitType.Star);
     }
 }
Пример #5
0
 private bool IsStar(DefinitionBase definition)
 {
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.Width.IsStar ?? ((RowDefinition)definition).Height.IsStar;
 }
Пример #6
0
 private double GetMinLength(DefinitionBase definition)
 {
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.MinWidth ?? ((RowDefinition)definition).MinHeight;
 }
Пример #7
0
        protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
        {
            base.OnAttachedToVisualTree(e);
            _grid = this.GetVisualParent<Grid>();

            _orientation = DetectOrientation();

            int defenitionIndex; //row or col
            if (_orientation == Orientation.Vertical)
            {
                Cursor = new Cursor(StandardCursorType.SizeWestEast);
                _definitions = _grid.ColumnDefinitions.Cast<DefinitionBase>().ToList();
                defenitionIndex = GetValue(Grid.ColumnProperty);
                PseudoClasses.Add(":vertical");
            }
            else
            {
                Cursor = new Cursor(StandardCursorType.SizeNorthSouth);
                defenitionIndex = GetValue(Grid.RowProperty);
                _definitions = _grid.RowDefinitions.Cast<DefinitionBase>().ToList();
                PseudoClasses.Add(":horizontal");
            }

            if (defenitionIndex > 0)
                _prevDefinition = _definitions[defenitionIndex - 1];

            if (defenitionIndex < _definitions.Count - 1)
                _nextDefinition = _definitions[defenitionIndex + 1];
        }
Пример #8
0
        private bool IsStar(DefinitionBase definition)
        {
            var columnDefinition = definition as ColumnDefinition;

            return(columnDefinition?.Width.IsStar ?? ((RowDefinition)definition).Height.IsStar);
        }
Пример #9
0
 /// <summary>
 /// Adds / registers a definition instance.
 /// </summary>
 internal void AddMember(DefinitionBase member)
 {
     Debug.Assert(!_registry.Contains(member));
     _registry.Add(member);
     Invalidate();
 }