wpf如何更改网格内的控件
我最近开始关注 wpf,并且很难理解它。我已经写了很多 c++ 和 c# 的东西,但 xmal 现在对我来说似乎有点陌生。我创建了一个带有网格的主窗口。在网格内,我有一个用户控件,我可以动态创建按钮。根据用户按下的按钮,控件应该加载另一个用户控件来代替当前控件,类似于 win7 手机的工作方式......这是一个桌面应用程序而不是手机应用程序......只是想给你一个例子的期望结果。我查看了页面和导航,但我不认为这就是我正在寻找的。有人可以指出我正确的方向吗?谢谢
I started looking at wpf recently and am having a hard time wrapping my head around it. I have written plenty of c++ and c# but xmal seems a bit foreign to me right now. I have created a main window that has a grid. Within the grid i have a user control that i dynamically create buttons. Depending on which button the user presses the control should load another user control in place of the current control, kind of how a win7 phone would work... This is a desktop app not a phone app.. just wanted to give you an example of the desired result. I have looked at Pages and Navigation but i don't think this what i'm looking for. Can someone please point me in the right direction. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 Xaml 中添加“ContentControl”
然后在代码中更改其内容,例如:
ContentControl1.Content = new MyUserControl();
You could put a "ContentControl" in your Xaml
and than in your code change it's content, like:
ContentControl1.Content = new MyUserControl();