LibraryBar / LibraryContainer - 更改拖放行为 [英] LibraryBar / LibraryContainer - change drag-drop behaviour

查看:75
本文介绍了LibraryBar / LibraryContainer - 更改拖放行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

默认情况下,当我从LibraryBar或LibraryContainer拖动一个项目并将其放到另一个项目时 - 它会被移动到它中。我想改变那种行为,所以不能从源容器中删除项目,只是复制到目标。

By default when I drag an item from LibraryBar or LibraryContainer and drop it to another one - it's being moved into it. I want to change that behaviour so item must not be removed from the source container and just copied to target.

我试图搜索msdn并在这里找到一些示例代码  http://msdn.microsoft.com/en-us/library /ee957313(v=surface.15).aspx  但它对我没有用
,而且它不是我需要的。

I've tried to search msdn and found some example code here http://msdn.microsoft.com/en-us/library/ee957313(v=surface.15).aspx but it didn't worked for me, moreover it's not exactly what I need.

Can有人帮我吗?

谢谢。

推荐答案

您好

  正如您可以阅读msdn文章
使用LibraryContainer控件

   as you can read on the msdn article Using the LibraryContainer Control

默认情况下,LibraryContainer控件的项目已启用,并在用户将其拖动到另一个控件时被禁用。 LibraryContainer控件中的禁用项具有以下特征:

By default, the items of a LibraryContainer control are enabled and become disabled when users drag them into another control. A disabled item in a LibraryContainer control has the following characteristics:


  • 在水平栏视图中,禁用的项目显示为灰色。用户无法拖动它。
  • 在垂直堆栈视图中,项目将从堆栈中删除。

 

您可以使用
SetIsItemDataEnabled
方法。以下代码示例禁用所有小项。

You can change the state of an item by using the SetIsItemDataEnabled method. The following code example disables all small items.

foreach (System.Xml.XmlNode node in MainLibraryContainer.ItemsSource)
{
    if (node.Attributes["Size"] != null && node.Attributes["Size"].Value == "Small")
    {
        MainLibraryContainer.SetIsItemDataEnabled(node, false);
    }
}

希望有帮助


这篇关于LibraryBar / LibraryContainer - 更改拖放行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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