随笔分类 -  WPF

wpf应用与开发
摘要:WPF中 DataGrid 列头合并,类似于报表设计。效果图如下↓1.新建一个WPF项目WpfApplication1,新建一个窗体DataGridTest,前台代码如下: 2.后台CS文件代码如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using S... 阅读全文
posted @ 2013-12-17 01:15 _YMW 阅读(12692) 评论(0) 推荐(1) 编辑
摘要:1.如图所示:绑定树效果图2.前台Xaml代码: --> --> 2.后台cs代码:采用递归无限极向下查询using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows... 阅读全文
posted @ 2013-11-29 21:38 _YMW 阅读(17278) 评论(5) 推荐(0) 编辑
摘要:如图:点击浏览可弹出选择文件对话框,显示文件路径1.在项目中添加新项,选择天加一个控件UserControl1.xaml,取名FileInputBox在用户控件添加按钮和文本框,XAML代码如下:浏览...2.用户控件cs代码如下: public partial class FileInputBox : UserControl { public FileInputBox() { InitializeComponent(); theTextBox.TextChanged += new TextChangedEventHandler(OnTextChanged); } private void t 阅读全文
posted @ 2013-09-23 19:55 _YMW 阅读(385) 评论(0) 推荐(0) 编辑
摘要:读取XPS格式文件或将doc,txt文件转化为XPS文件,效果图如下:1.XAML页面代码: 2.后台CS文件代码:首先引用Microsoft.Office.Interop.Word.dll;//具体代码如下↓using System;using System.IO;using System.Linq;using System.Windows;using System.Windows.Controls;using System.Windows.Xps.Packaging;using System.Xml;using Microsoft.... 阅读全文
posted @ 2013-09-16 19:10 _YMW 阅读(7053) 评论(2) 推荐(0) 编辑
摘要:实现效果如下图:功能:实现查找文件名包含输入关键字的文件实现代码:导入命名空间:using System.Threading;using System.Diagnostics;引用dll System.Windows.Forms1.选择要查找的文件夹路径:代码如下/// /// 选择路径事件/// /// /// private void button1_Click(object sender, RoutedEventArgs e){ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBr 阅读全文
posted @ 2013-08-28 19:26 _YMW 阅读(518) 评论(0) 推荐(0) 编辑
摘要:MVVM模式能够帮你把你程序的业务与展现逻辑从用户界面干净地分离开。保持程序逻辑与界面分离能够帮助解决很多开发以及设计问题,能够使你的程序能更容易的测试,维护与升级。它也能很大程度的增加代码重用性,并让开发者与界面设计者更容易地相互合作。使用MVVM模式,程序的UI和其背后的展现与业务逻辑将被分离至三个类中:1-视图,封装UI与UI逻辑2-模型视图,封装展示逻辑与状态3-模型,封装程序的业务逻辑以及数据MVVM模式是展示-模型模式的变种,它优化了一些WPF的核心特性,例如数据绑定,数据模版,命令以及行为。在MVVM模式中,视图通过数据绑定以及命令行与视图模型交互,并改变事件通知。视图模型查询观 阅读全文
posted @ 2013-07-18 09:53 _YMW 阅读(298) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// WPF中查找元素的父元素 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="i_dp"></param> /// <returns></returns> public static T FindParent<T>(DependencyObject i_dp) where T : DependencyObject { Depen 阅读全文
posted @ 2013-02-18 16:16 _YMW 阅读(5635) 评论(0) 推荐(1) 编辑
摘要:1.首先需要一个集合用来测试://定义一个集合要用的类:public class People{ public People(string name, string sex, int age,decimal height) { this.Name = name; this.Sex = sex; this.Age = age; this.Height = height; } public string Name { get; set; } public string Sex { get; set; } public int Age { get; set; } public decimal Hei 阅读全文
posted @ 2012-12-12 19:41 _YMW 阅读(4378) 评论(1) 推荐(1) 编辑
摘要:WinForm窗体居中:this.StartPosition = FormStartPosition.CenterScreen;WPF窗体居中: WindowStartupLocation = WindowStartupLocation.CenterScreen; 阅读全文
posted @ 2011-05-23 17:40 _YMW 阅读(661) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示