拖放UWP

时间:2016-09-29 15:31:10

标签: c# xaml mvvm uwp

我的View UserControl Binding ObservableCollection来自ViewModel来自allowDrop,我有一些照片。我制作了true DragOver并撰写了<Grid Margin="0,0,0,0" AllowDrop="True" Drop="<!--Dont know what to do-->"> <Image Source="{x:Bind Image}" 方法,但我如何才能收到图片/图片并将其添加到我的收藏中?

这里有一些代码:

Image

DataTemplateBindingObservableCollection使用List<string> previousWeaponList = new StreamWriter("PreviousList.txt");

1 个答案:

答案 0 :(得分:0)

我在XAML控件上写了这个行为

 <interactivity:Interaction.Behaviors>
        <behaviors:ItemDropBihevior ItemDropCommand="{Binding ImageManipulatorViewModel.DropImageCommand, Source={StaticResource ViewModelLocator}}"/>
        <core:EventTriggerBehavior EventName="Drop">
            <core:InvokeCommandAction  CommandParameter="{Binding}">
            </core:InvokeCommandAction>
        </core:EventTriggerBehavior>
    </interactivity:Interaction.Behaviors>

然后赶上ViewModel并加入我的选举