DragStarted-Event for AppBarButtons not working

Sven Drescher 1 Reputation point
2021-12-02T13:57:19.873+00:00

Hello alltogether,

I looked for a solution to drag a control element e.g. AppBarButton, Button. In the API-reference an event was described but isn't working. What can I do?

Thanx,
Sven

And here's the code, quite simple, Textbox working with drag and AppBarButton not :-(

MainPage.xaml
<Page
x:Class="LazyBrain.MainPage"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:LazyBrain"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>

    <muxc:TwoPaneView
        Name="LazyBrainTwoPaneView"
        MaxWidth="2688"
        MaxHeight="1892"
        ModeChanged="LazyBrainTwoPaneView_ModeChanged" >

        <muxc:TwoPaneView.Pane1>
           ...
        </muxc:TwoPaneView.Pane1>

        <muxc:TwoPaneView.Pane2>
            <Grid Name="Pane2Root" MaxWidth="1344" MaxHeight="1892"  DragOver="Pane2Root_DragOver">

                <Grid.RowDefinitions>
                </Grid.RowDefinitions>

                <local:NotePanelControl Grid.Row="0" CanDrag="True"/>

                <ScrollViewer Name="Pane2ScrollViewer" AllowDrop="True" Grid.Row="1" DragOver="Pane2Root_DragOver">
                    <StackPanel Name="Pane2StackPanel" Padding="16">
                        <TextBlock Text="Notes" MaxLines="1" Style="{ThemeResource HeaderTextBlockStyle}"/>
                        **<TextBlock Text="SingleNote" Style="{ThemeResource SubheaderTextBlockStyle}" CanDrag="True" DragStarting="TextBlock_DragStarting"/>**
                        <Rectangle CanDrag="True" DragStarting="AppBarButton_DragStarting"/>

                        **<AppBarButton Name="TestBarButton" Label="Accept" Icon="Accept" CanDrag="True" DragStarting="AppBarButton_DragStarting" DragLeave="AppBarButton_DragLeave" Click="AppBarButton_Click"/>**

                        <local:NoteElementControl CanDrag="True"/>

                    </StackPanel>
                </ScrollViewer>
            </Grid>
        </muxc:TwoPaneView.Pane2>
    </muxc:TwoPaneView>

    <VisualStateManager.VisualStateGroups>

...
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

Universal Windows Platform (UWP)
{count} votes