wpf中的用户控件 [英] user controls in wpf

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

问题描述

我想将用户控件添加到窗口中(使用wpf).
在C#中,我只写

form1.Controls.Add('用户控件的名称' );
'usercontrol的名称'.location =新点........

当我使用wpf appliction时我该怎么做
id可以同时使用xaml和在代码部分中看到两种方式.
感谢您

i want to add a user control to a window (using wpf).
in c# i would just write 

form1.Controls.Add('name of user control');
'name of usercontrol'.location= new point........

how do i do this when im using a wpf appliction
id like to see both ways, is xaml and in the code part
thank you

推荐答案

这是一个很好的教程,介绍了如何在运行时使用代码添加控件,以及相应的XAML会是什么样子:
Here's a good tutorial on how to add controls at runtime using code, and also what the corresponding XAML would look like:


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

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