牛腩WPF框架
上中下三部分,中间分左右二部分,点击左边右边tab标签页显示
标签页关闭的功能抄https://www.cnblogs.com/tsliwei/p/5625398.html的,不错不错。。
源码GIT地址:https://niunan-01.coding.net/public/lx0012.niunanwpfkuangjia/lx0012/git/files
部分代码:
/// <summary> /// 双击左边树节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ClickTreeNode(object sender, MouseButtonEventArgs e) { string head = (sender as TreeViewItem).Header.ToString(); string framename = (sender as TreeViewItem).Tag.ToString(); bool ishas = false; //是否已经存在tab标签 foreach (UCTabItemWithClose one in tab_Main.Items) { if (one.Header.ToString() == head) { ishas = true; one.IsSelected = true; } } if (!ishas) { UCTabItemWithClose item = new UCTabItemWithClose(); item.Header = string.Format("{0}", head); item.ToolTip = string.Format("{0}", head); item.Margin = new Thickness(0, 0, 1, 0); item.Height = 28; //反射 Assembly assembly = Assembly.Load("Niunan.WPFKJ"); //根据字符串取类型 Type type1 = assembly.GetType("Niunan.WPFKJ.News." + framename); //根据类型创建对象 dynamic view = Activator.CreateInstance(type1); Frame frame = new Frame() { Content = view }; item.Content = frame; item.IsSelected = true; tab_Main.Items.Add(item); } }
标签:head,string,框架,item,tab,牛腩,WPF,ishas From: https://www.cnblogs.com/niunan/p/17762400.html