Skip to content

The canvas dragging exhibits abnormal lag #514

@Yeilintong

Description

@Yeilintong

The canvas dragging exhibits abnormal lag. After replacing the default layout container of ListView with Canvas, all dragging operations within the ListView demonstrate unusual stuttering issues.

 <ListView ItemsSource="{Binding Icons}"
              Style="{StaticResource CustomListViewStyle}"
              dd:DragDrop.IsDragSource="True"
              dd:DragDrop.IsDropTarget="True"
              dd:DragDrop.DropHandler="{Binding}"
              dd:DragDrop.UseDefaultDragAdorner="True"
              dd:DragDrop.UseDefaultEffectDataTemplate="True">

        <i:Interaction.Triggers>
            <i:EventTrigger EventName="MouseRightButtonUp">
                <i:InvokeCommandAction 
                    Command="{Binding RightClickCommand}"
                    CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType=ListView}}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
        
        
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas Background="#02FFFFFF"/>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>

        <ListView.ItemContainerStyle>
            <Style TargetType="ListViewItem" BasedOn="{StaticResource CustomListViewItemStyle}">
                <Setter Property="Canvas.Left" Value="{Binding X, Mode=TwoWay}"/>
                <Setter Property="Canvas.Top" Value="{Binding Y, Mode=TwoWay}"/>
            </Style>
        </ListView.ItemContainerStyle>

        <ListView.Resources>
            <DataTemplate DataType="{x:Type viewModels:IconModel}">
                <views1:IconView Width="64" Height="80"/>
            </DataTemplate>
        </ListView.Resources>

    </ListView>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions