Example #1
0
 internal Cursor(StandardCursorType type)
 {
     cursor = new Avalonia.Input.Cursor(type);
 }
Example #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];
     }
 }
Example #3
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];
        }