WPF中TreeView控件的使用案例
作者: / 2019-12-09 / 浏览次数:
mainwindowviewmodel viewmodel = new mainwindowviewmodel; list filetreemodel filetreedata = new list filetreemodel public mainwindow initializecomponent; /// summary /// 每一天相片计算 /// /summary public static int total = 0; /// summary /// 获取相片目录调集 /// /summary /// param name="dir" /param /// param name="d" /param /// returns /returns public list filetreemodel getallfiles list filetreemodel filelist = new list filetreemodel fileinfo[] allfile = dir.getfiles; total = allfile.count; foreach d.subitem.add { filename = fi.name, filepath = fi.fullname, filetype = fieletypeenum.picture, icon = "../refresh/picture.ico" }); directoryinfo[] alldir = dir.getdirectories; foreach filetreemodel filedir = new filetreemodel { filename = dif.name, filepath = dif.fullname, filetype = fieletypeenum.folder, icon = "../refresh/folder.ico" }; getallfiles; filedir.subitemcount = string.format"); filelist.add; return filelist; /// summary /// tab挑选事情 /// /summary /// param name="sender" /param /// param name="e" /param private void tabcontrol_selectionchanged if if if tabitem tabitem = e.addeditems[0] as tabitem; if == "过磅记载") if == "相片预览") string datadir = appdomain.currentdomain.basedirectory + "imagelogs\"; filetreedata = getallfiles, new filetreemodel).orderbydescending.tolist; this.departmenttree.itemssource = filetreedata; /// summary /// 文件树选中事情 /// /summary /// param name="sender" /param /// param name="e" /param private void departmenttree_previewmouseup if filetreemodel selectedtnh = departmenttree.selecteditem as filetreemodel; viewmodel.model.selectfilelename = selectedtnh.filename; if fieletypeenum.picture) bitmapimage imagesouce = new bitmapimage; imagesouce = new bitmapimage);//uri myimage.source = imagesouce.clone; catch messagebox.show);
【某某业务】网站建设、网站设计、服务器空间租售、网站维护、网站托管、网站优化、百度推广、自媒体营销、微信公众号
如有意向---联系我们
热门栏目
热门资讯

网站建设 网站托管 成功案例 新闻动态 关于我们 联系我们 服务器空间 加盟合作 网站优化

备案号: 

公司地址:江苏省南京市玄武区玄武湖 咨询QQ:9490489 手机: 电话: