如何在wpf中单击按钮添加用户控件 [英] how to add user controls on a button click in wpf

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

问题描述

您好,



我在主窗口中有一个项目列表,我有一个用户控件。这些是与每个项目相关的一些值或字段在list.i中需要显示与数据网格中列表中每个项目相关的字段,因为我选择了每个项目。我只需要在列表中选择的项目内容。选择下一个项目相关的项目时这必须从网格中消失。依此类推。怎么办呢?任何人都有任何想法。



请帮帮我

Hello,

I have a list of items in the main window and i have a user control.Thers is some Values or fields related to each of the items in the list.i need to show the fields related to each item in the list on a data grid as i select each item.I need to have only the contents of items that i selected on the list.When selecting next item fields related to this must be gone from grid.and so on.How can it be done?Anyone have any idea.

please help me

推荐答案

请找到代码。



Please find the code.

UserControl userControl = new UCTeamTweet();
userControl.Width = Convert.ToInt32("500");
userControl.Height = Convert.ToInt32("900");
userControl.HorizontalAlignment = HorizontalAlignment.Left;
userControl.VerticalAlignment = VerticalAlignment.Top;
stkPnlSearch.Children.Add(userControl); // Add to the stack panel.





在button_click事件中执行此操作。



Perform this action inside button_click event.


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

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