![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
.net
文章平均质量分 78
easybjy
这个作者很懒,什么都没留下…
展开
-
WPF Binding相关的一些常见方式总结(四)
将一个文本框中文本长度绑定给另一个文本框显示: //注意,这里的Mode要选OneWay. 改为后台实现就是:tbx2.SetBinding(TextBox.TextProperty, new Binding("Text.Length") {Mode=BindingMode.OneWay原创 2015-03-06 16:10:13 · 503 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(五)
集合绑定初级:前端: 后端: public Window3() { InitializeComponent(); List stringList = new List() { "tom", "lucy"翻译 2015-03-06 16:13:04 · 471 阅读 · 0 评论 -
WPF Command 案例
实现这一一个需求:定义一个命令,使用Button来发送命令,当命令送达TextBox时TextBox会被清空,若TextBox中没有文字则命令不可被发送。前端: 后台: public partial class Window1 : Window { private RoutedCommand rcmd翻译 2015-03-27 16:25:17 · 563 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(八)
列表控件绑定到集合:前端:<Window x:Class="Demo.Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s原创 2015-03-06 16:49:53 · 767 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(六)
前端资源绑定的几种典型方式:<Window x:Class="Demo.Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sy原创 2015-03-06 16:44:51 · 517 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(七)
没有Source的Binding, 使用DataContext作绑定源;(实现与案例A一样的功能):前端: Model:public class Student : INotifyPropertyChanged { private string stuNa原创 2015-03-06 16:45:28 · 498 阅读 · 0 评论 -
附加属性案例
附加属性: 例如一个TextBox,它可能被放在一个Grid中,也可能被放在一个Canvas、StackPanel中,但文本框的设计者不可能知道控件发布后程序员是把它放在Grid里还是Canvas里,所以他也不可能为TextBox准备诸如Column、Row或者Left、Top这类属性,那么干脆让布局来决定一个TextBox用什么属性设置其位置吧! 附加属性的本质就是依赖属性;翻译 2015-03-20 10:28:08 · 606 阅读 · 0 评论 -
路由事件初级案例
前端: 后台: public partial class MainWindow : Window { public MainWindo翻译 2015-03-20 15:53:16 · 402 阅读 · 0 评论 -
路由事件中级案例
前端: 后台: public partial class Window2 : Window { public Window2() { Initia翻译 2015-03-20 15:57:14 · 399 阅读 · 0 评论 -
路由事件——附加事件案例
1,前端: 2,后台: public partial class AttachedEventDemo : Window { Student stu = new Student() { Name = "Tim" }; public AttachedEventDemo() {翻译 2015-03-20 17:32:10 · 568 阅读 · 0 评论 -
使用Linq检索结果作为绑定源
本例介绍通过Linq检索三种重要绑定来源:Model: public class AStudent { public string Alias { get; set; } public string StuName { ge翻译 2015-03-17 13:52:11 · 398 阅读 · 0 评论 -
WPF 命令参数案例
前端: 后台: pu翻译 2015-03-27 17:18:31 · 1016 阅读 · 0 评论 -
WPF中TreeView和Xml的结合使用案例
前端代码:<Window x:Class="Demo.Xml621" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Xml621" Hei翻译 2015-03-17 10:34:55 · 4701 阅读 · 0 评论 -
ObjectDataProvider使用简单案例
前端:<Window x:Class="Demo.ObjDataProviderDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Ob翻译 2015-03-18 16:42:15 · 1660 阅读 · 0 评论 -
ObjectDataProvider 作为Binding的Source来使用的案例
ObjectDataProvider 作为Binding的Source来使用的案例:前端:<Window x:Class="Demo.ObjDataProviderDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mi翻译 2015-03-18 17:32:34 · 470 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(三)
控件之间的互相绑定: 换种方式在后台实现,以上代码相当于: --> public partial class Window1 : Window {原创 2015-03-06 16:08:04 · 416 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(二)
由于许多类似TextBox的UI元素的基类FrameworkElement对BindingOperation.SetBinding(...)进行了封装,所以案例A中的Binding部分可以从:Binding bd = new Binding(); bd.Source = myStu; bd.Path = new PropertyPath("Stu原创 2015-03-06 16:05:25 · 390 阅读 · 0 评论 -
在一个项目中明明引用了某工程, 在引用时也能智能地提示,但编译时却提示没有using引用
检查各工程的属性中目标框架一项, 确保都相同。比如, 我原本的几个工程都是用的.Net framework4.0, 而新来的一个工程使用.netFramework 3.5或者.net framework 4.0 client profile.就会产生题目中的错误。参考:http://cnn237111.blog.51cto.com/2359144/630861原创 2012-07-18 16:09:17 · 728 阅读 · 0 评论 -
winform拖拽自定义用户控件到设计器时报错, 而运行无错的情况
最近在做一个Winform软件的换肤部分功能, 主要就是在各个控件的Paint事件中加入相应的加载资源文件的代码。出现错误较为频繁的一个点是, 代码写好了, 运行没问题,一旦将自定义控件拖拽到设计器中就报错。最终解决的办法是,在代码中判断component.designmode这个变量的状态, 如果为true则说明处于设计模式, 则不执行paint部分代码;反之处于运行状态, 就进行喷绘。原创 2012-07-23 13:54:50 · 4348 阅读 · 1 评论 -
ColorBlend学习
From:http://blog.csdn.net/yglbj/article/details/5654792using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;us转载 2012-07-26 11:49:10 · 2754 阅读 · 0 评论 -
c#绘图
http://www.cnblogs.com/panjun-Donet/articles/1236739.html原创 2012-07-25 18:17:01 · 426 阅读 · 0 评论 -
设计器是如何确定哪些属性会在Designer.cs中生成的?
之所以要解决这个问题, 是因为, 我的自定义组件代码是这样写的:private int _radius;public int Radius{ get { return this._radius; } set { this._radius = value; }}Radius值我将在构造函数里面, 从资源文件中获取,同时, 我想_radius的值也就有了。当我把自原创 2012-07-27 18:49:29 · 1326 阅读 · 0 评论 -
Visual studio最常用热键(快捷键)hottest_keys_set
查找某关键字所有引用: shift+F12显示属性窗口:F4打开解决方案资源管理器: Ctrl+Alt+L打开工具箱: Ctrl+Alt+X导航到上一个操作页面处: Ctrl + 减号导航到下一个操作页面处: Ctrl + Shift + 减号添加现有项: Alt + Shift + A添加新项: Ctrl + Shift + A格式化选中代码: Ctrl + K原创 2012-07-27 18:59:58 · 367 阅读 · 0 评论 -
Cannot modify the return value of 'System...ClientRectangle' because it is not a variable
最近做一个换肤的程序, 在修改窗体的ClientRectangle.Height值的时候出现了题目这样的错误。 后来发现,把鼠标放到ClientRectangle.Height的Height上时, 显示可以进行Get和Set但 ClientRectangle本身的定义里面只支持Get操作, 而没有Set操作, 它不是一个变量, 是Control类的一个公共属性。然后发现Control类原创 2012-07-28 09:11:55 · 1011 阅读 · 0 评论 -
c# .Net 根据资源文件名获取资源文件对象
string imageName; public string ImageName { get { return imageName; } set { imageName = value; this.BackgroundIma原创 2012-07-30 15:33:39 · 4044 阅读 · 0 评论 -
Winform画背景图片的两种方法TextureBrush与Graphics.DrawImage()
1, 使用drawImage的例子:private void DrawImage(Graphics g) { if (backImg == null) return; else this.Size = backImg.Size; Rectang原创 2012-08-01 10:38:01 · 5727 阅读 · 0 评论 -
我对委托、事件委托的一点理解
//1.声明关于事件的委托; public delegate void AlarmEventHandler(object sender, EventArgs e);以上,声明一个委托, 类似C语言中声明一个函数指针的类型, 这个类型说明了 由它去声明的指针 所指向的函数 的参数类型和返回类型。//2.声明事件(委托); public event AlarmEven原创 2012-08-31 09:53:31 · 397 阅读 · 0 评论 -
Binding- 数据转换
1,前端:翻译 2015-03-19 13:32:11 · 359 阅读 · 0 评论 -
Binding之RelativeSource
有时我们不能确定作为Source的对象叫什么名字,但知道它与作为Binding目标的对象在UI布局上有相对关系,比如控件自己关联自己的某个数据、某级容器的数据。这时就可以用RelativeSource。前端:<Window x:Class="Demo.RelativeSrcDemo" xmlns="http://schemas.microsoft.com/winfx/200翻译 2015-03-19 10:47:33 · 436 阅读 · 0 评论 -
Binding-Validation
Binding对数据的转换和校验案例:前端:<Window x:Class="Demo.ValidationRuleDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/x翻译 2015-03-19 11:55:33 · 413 阅读 · 0 评论 -
Binding之MultiBinding
本例实现:第一二个TextBox输入内容一致,第二三个TextBox输入内容一致时,Button被启用.前端: 后台: public partial class MultiBindingDemo : Window翻译 2015-03-19 14:49:45 · 555 阅读 · 0 评论 -
依赖属性实验案例一
目的:通过一个Student对象,实现前端两个TextBox输入值相同(此案例仅做实验,用于理解最简单的依赖属性用法,实际中不会这样用)前端: 后台: public partial class MainWindow : Window { Studen翻译 2015-03-19 17:33:21 · 538 阅读 · 0 评论 -
WPF Binding相关的一些常见方式总结(一)
Model: public class Student : INotifyPropertyChanged { private string stuName; public string StuName { get { return stuName; } set { stuName = value; if (PropertyChanged != null) { this.PropertyChange原创 2015-03-06 15:55:54 · 588 阅读 · 0 评论 -
TextureBrush画刷 重复显示问题(图像便宜问题)
近来用TextureBrush画一个背景, 把坐标改为非(0,0)的情况时, 以原大小显示的时候总是出现偏移, 以更大的尺寸显示时, 会出现无数个图片。 后来找到了解决方案:TextureBrush br = new TextureBrush( logo );详细参考:http://blog.csdn.net/tjvictor/article/details/758331原创 2012-08-03 14:28:43 · 930 阅读 · 0 评论