Skip to content

ApplicationDraggableLocationChangedEventArgs.Draggable

property · ApplicationDraggableLocationChangedEventArgs · cAlgo.API Since 5.2

DesktopCLICloud

Gets the draggable.

Environment behaviour

CLI — not supported. Never raised in the CLI: the events that pass it never fire there (ApplicationDraggable.LocationChanged).

Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (ApplicationDraggable.LocationChanged).

Definition

public ApplicationDraggable Draggable {get;}
applicationDraggableLocationChangedEventArgs.Draggable: ApplicationDraggable

Returns ApplicationDraggable

Examples

protected override void OnStart()
{
    var draggable = Application.Draggables.Add();
    draggable.Child = new TextBlock { Text = "Drag me" };
    draggable.LocationChanged += OnDraggableLocationChanged;
}

private void OnDraggableLocationChanged(ApplicationDraggableLocationChangedEventArgs args)
{
    var draggable = args.Draggable;
    Print("Draggable {0} is visible: {1}, location: ({2}, {3})", draggable.Id, draggable.IsVisible, draggable.X, draggable.Y);
}
def on_start(self):
    draggable = api.Application.Draggables.Add()
    text_block = TextBlock()
    text_block.Text = "Drag me"
    draggable.Child = text_block
    draggable.LocationChanged += self.on_draggable_location_changed

def on_draggable_location_changed(self, args):
    draggable = args.Draggable
    api.Print(f"Draggable {draggable.Id} is visible: {draggable.IsVisible}, location: ({draggable.X}, {draggable.Y})")