关于LibraryStack控件的简单问题 [英] Simple question on LibraryStack control

查看:72
本文介绍了关于LibraryStack控件的简单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


我正在使用包含图片集合的LibraryStack控件。在应用程序中,每个LibraryStack都包含来自其自己文件夹的图片。到目前为止一直很好。


我的情况如下:


我有5个不同的LibraryStack来自哪里我可以拖放图片了。但我想避免将属于FolderA的图片拖回错误的LibraryStack中。默认情况下它是允许的,因为对象都是相同的类型。



我尝试在LibraryStack上捕获不同的事件,以便在项目被删除并添加到事件之前捕获事件该集合然后进行测试,如果源目录相同但无法获得正确的事件来跟踪。


感谢您的帮助

serge


您的知识会被其他人的知识所提升。

解决方案

您好


   我认为你应该使用Surface
拖放式框架

AddPreviewQueryTargetHandler方法


类似于:

 SurfaceDragDrop.AddPreviewQueryTargetHandler(YouConrol,OnPreviewQueryTargetYourControl); 

private void OnPreviewQueryTargetLibraryItems1(object sender,QueryTargetEventArgs e)
{
// event args具有检查拖动对象是否属于目标控件所需的全部
if((拖动对象属于目标控件)== false)
{
e.UseDefault = false;
e.ProposedTarget = null;
}
e.Handled = true;
}




Dear all,

I am using the LibraryStack control which contains a collection of Pictures. In the application each LibraryStack contains pictures from its own folder. So far so good.

The scenario I have is the following :

I have 5 different LibraryStack from wich I can drag and drop pictures out. But I would like to avoid that a Picture belonging to FolderA gets dragged back in the wrong LibraryStack. By default it is allowed because objects are all same type.

I try to catch different event on LibraryStack in order to catch an event before the item gets drop and added to the collection and then make a test if the source directory is the same but could not get the proper event to track.

Thanks for help
serge


Your knowledge is enhanced by that of others.

解决方案

Hi

    i think you should use the Surface Drag-and-Drop Framework and AddPreviewQueryTargetHandler Method

Something like:

SurfaceDragDrop.AddPreviewQueryTargetHandler(YouConrol, OnPreviewQueryTargetYourControl);

private void OnPreviewQueryTargetLibraryItems1(object sender, QueryTargetEventArgs e)
        {
            //event args has all that you need to check if the dragged object belongs to the target control
            if ((dragged object belongs to target control) == false)
            {
                e.UseDefault = false;
                e.ProposedTarget = null;
            }
            e.Handled = true;
        }


这篇关于关于LibraryStack控件的简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆