在SilverLight 4.0中的两个自定义控件之间连接线? [英] Connecting Lines between two custom controls in SilverLight 4.0?

查看:80
本文介绍了在SilverLight 4.0中的两个自定义控件之间连接线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我已经使用Canvas作为根对象.我在运行时将其拖放到自定义控件"上.所以,能否请您告诉我如何在Silverlight4.0中的两个自定义控件之间绘制连接线?

Hello Everyone,


I have used Canvas as root Object. On which i drag and drop Custom Control at run time. So Can you please tell me how can i draw Connecting Lines Between two Custom Control in Silverlight4.0?

推荐答案

基本上,您没有在Canvas上绘制,您将类型为UIElement的对象放在上面.因此,使用System.Windows.Shapes.Line类型的对象连接控件,请参见:
http://msdn.microsoft.com/zh-cn/library/system.windows.shapes.line%28v = VS.95%29.aspx [ http://msdn.microsoft.com/zh-cn/library/system.windows.controls.canvas%28v = VS.95%29.aspx [ http://msdn.microsoft.com/zh-cn/library/system.windows.frameworkelement%28v = VS.95%29.aspx#inheritanceContinued [ http://msdn.microsoft.com/zh-cn/library/system.windows.shapes.shape%28v = VS.95%29.aspx [
Basically, you do not draw on Canvas, you put objects of the type UIElement on it. So, use the objects of the type System.Windows.Shapes.Line to connect your controls, see:
http://msdn.microsoft.com/en-us/library/system.windows.shapes.line%28v=VS.95%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas%28v=VS.95%29.aspx[^].

Look through all the hierarchy starting from System.Windows.UIElement and especially from System.Windows.Shapes.Shape, see:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement%28v=VS.95%29.aspx#inheritanceContinued[^],
http://msdn.microsoft.com/en-us/library/system.windows.shapes.shape%28v=VS.95%29.aspx[^].

May be you will find a lot more helpful elements to put on your canvas… :-)

—SA


这篇关于在SilverLight 4.0中的两个自定义控件之间连接线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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