Exemplo n.º 1
0
 private double GetActualLength(DefinitionBase definition)
 {
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.ActualWidth ?? ((RowDefinition)definition).ActualHeight;
 }
Exemplo n.º 2
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];
     }
 }
Exemplo n.º 3
0
 private bool IsStar(DefinitionBase definition)
 {
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.Width.IsStar ?? ((RowDefinition)definition).Height.IsStar;
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 5
0
 private double GetMaxLength(DefinitionBase definition)
 {
     var columnDefinition = definition as ColumnDefinition;
     return columnDefinition?.MaxWidth ?? ((RowDefinition)definition).MaxHeight;
 }