WPF Layer Control

99封情书 提交于 2019-12-23 21:07:17

问题


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

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

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

3) Move layers up/down the stack

4) Change opacity for layers

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?


回答1:


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.

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.

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

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.

That's just my 2 cents.



来源:https://stackoverflow.com/questions/495249/wpf-layer-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!