WPF层控制 [英] WPF Layer Control

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

问题描述

我需要执行以下操作的WPF图层控件

I'm in need of a WPF layer control that does the following

1)彼此之间具有多层内容.

1) Have multiple layers of content on top of each other.

2)能够在设计和运行时打开/关闭图层,即我们需要一个UI,例如标签式控件

2) Ability to turn layers on/off at design and runtime, ie we need a UI maybe something like a tabbed control

3)在堆栈中上/下移动层

3) Move layers up/down the stack

4)更改图层的不透明度

4) Change opacity for layers

现在我知道以上所有内容都可以在Xaml/WPF中使用.我已经使用网格编写了一个简单的版本,该网格在设计时具有多个单元,1个单元= 1层,在运行时只有一个单元,所有单元都合并为一个.事实是,这很麻烦,没有给我所需的设计时间控件,所有控件最终都由一个单亲父母组成,丑陋.任何人都可以买到现成的或部分可用的示例-否则,我将编写一个合适的示例,并在CodePlex上共享它.

Now I know all of the above is possible in Xaml/WPF. I've coded up a simple version using a grid, that has mutiple cells at design time, 1 cell = 1 layer, and only a single cell at runtime, all the cells are merged into one. Thing is that was a kludge, didn't give me the design time control that I needed, all controls end up with a single parent, ugly. Anyone got an off the shelf, or part working example - if not I'll code up a proper one and share it on CodePlex.

我确定我不是唯一需要此功能的人,对吗?

I'm sure I'm not the only person out there who needs this functionality, am I?

推荐答案

在我之前的客户中,我们使用Canvases完成了此任务.该应用程序本质上就像是一个"CAD",因此我们的层负责域的图形表示.

With my previous client we accomplished this using Canvases. The application was a 'CAD' like in nature so our layers were responsible for graphical representations of the domain.

目前,我还不知道有任何第三方工具可以做到这一点.

I do not know of any 3rd party tools that accomplish this at the moment.

我认为这样做的原因是,当您寻找此功能时,它非常特定于域&应用程序.

I think the reasoning for this is that when you are looking for this functionality it is very specific to the domain & application.

如果要构建自己的控件,我鼓励构建用于管理逻辑的自定义控件,然后允许其他人设计外观.这将更像是Wpf的解决方法.

If you were going to build your own control I would encourage building a custom control for managing the logic, then allow others to style the look and feel. It would be more of the Wpf way of approaching the problem.

以这种方式,如果1个消费者想要使用画布,他们可以使用.如果您想使用网格,那么也可以.

In that way if 1 consumer wants to use canvases they could. If you wanted to use a grid, then you could as well.

如果您有想要执行的伪代码,我可以查看是否可以修改我的任何旧POC以满足您的需求.或者,如果您想启动CodePlex项目,我也不会在意.

If you have any psuedo code of what you would like to do, I can see if any of my old POCs can be modified to meet your needs. Or if you want to start a CodePlex project I wouldn't mind contributing.

那只是我的2美分.

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

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