摘要: http://stackoverflow.com/questions/183406/xaml-newline-in-string-attributehttp://www.developerfusion.com/community/blog-entry/8389974/wpf如果可以写template的话,直接给2个textblock排在一个stackpanel里,或者写如果不可以要写hexidecimal 表达换行 阅读全文
posted @ 2013-08-15 11:26 若愚Shawn 阅读(494) 评论(0) 推荐(0) 编辑
摘要: LabeledTextBoxControl:C#定义using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;namespace Halliburton.Castor.Controls{ class LabeledTextBoxControl : Control { public static readonly DependencyProperty LabelP... 阅读全文
posted @ 2013-07-21 18:46 若愚Shawn 阅读(322) 评论(0) 推荐(0) 编辑
摘要: I always thought it was odd that WPF has both TextBlock and Label. They both are responsible for displaying a small amount of text. Every piece of documentation about Label I have read justifies its existence by mentioning that it allows for access keys. Access keys allow you to hit Alt + SomeKey to 阅读全文
posted @ 2013-07-20 22:02 若愚Shawn 阅读(415) 评论(0) 推荐(0) 编辑
摘要: What is DiffMergeDiffMerge is yet-another-diff-and-merge-tool from the fine folks at SourceGear. It’s awesome. It’s head and shoulders above whatever junky diff tool they provided with your source control platform, unless of course you’re already using Vault. Eric Sink, the founder of SourceGear, wr 阅读全文
posted @ 2013-07-09 08:42 若愚Shawn 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 转载fromVan Pan 的专栏http://blog.csdn.net/rryqsh/article/details/8274832http://blog.csdn.net/rryqsh/article/details/8277585Visual Studio 打包安装七宗罪开发.NET的人,肯定会使用Visual Studio里面自带的MSI打包安装工具框架。如果是在一般情况下,这个打包安装框架已经完全足够满足产品发布安装的需要了。它的制成品,是一个 setup.exe,一个MSI安装文件,如果你选择项目以来的其他.NET,Windows Install 框架,并且确定随产品发布,那制成 阅读全文
posted @ 2013-07-05 11:11 若愚Shawn 阅读(1144) 评论(0) 推荐(0) 编辑
摘要: 命名文件名和Class要一致(CamelCase)类公共和保护类型Property(CamelCase)类的公共和保护类型Fields(CamelCase)* 先采用.Net的命名方法,如果出现问题以后改成小写。Methord和Function(CamelCase)私有字段或者Property(_camelCase)parameter(camelCase)定义变量的位置最好在使用前,离得越近越好Type Var var x = 0; //x is an int var x = 0f; //x is a float var x = new Dictionary(); // x ... 阅读全文
posted @ 2013-06-27 16:36 若愚Shawn 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 特性(attribute)是被指定给某一声明的一则附加的声明性信息。 元数据,就是C#中封装的一些类,无法修改.类成员的特性被称为元数据中的注释. 1、什么是特性 1)属性与特性的区别属性(Property):属性是面向对象思想里所说的封装在类里面的数据字段,Get,Set方法。特性(Attribute):官方解释:特性是给指定的某一声明的一则附加 的声明性信息。 允许类似关键字的描述声明。它对程序中的元素进行标注,如类型、字段、方法、属性等。 从.net角度看,特性是一种 类,这些类继承于System.Attribute类,用于对类、属性、方法、事件等进行描述,主要用在反射中。但从面向... 阅读全文
posted @ 2013-06-26 10:14 若愚Shawn 阅读(2298) 评论(0) 推荐(0) 编辑
摘要: Windows Method 1: Using the Command Prompt1Click on theStartbutton.2Typecmdin the search bar, right above the Start button, and pressEnter. This will open the command prompt.If you're using Windows XP, clickRun, typecmd, and pressEnter.3At the command prompt, typeipconfig /alland pressEnter. Don 阅读全文
posted @ 2013-06-26 08:45 若愚Shawn 阅读(742) 评论(0) 推荐(0) 编辑
摘要: //十进制转二进制 Console.WriteLine(Convert.ToString(69, 2)); //十进制转八进制 Console.WriteLine(Convert.ToString(69, 8)); //十进制转十六进制 Console.WriteLine(Convert.ToString(69, 16)); //二进制转十进制 Console.WriteLine(Convert.ToInt32(”100111101″, 2)); //八进制转十进制 Console.WriteLine(Convert.ToInt32(”76″, 8)); //十六进制转十进制 Console. 阅读全文
posted @ 2013-06-25 15:10 若愚Shawn 阅读(5717) 评论(0) 推荐(0) 编辑
摘要: 封装field一般为private,定义的时候可以不赋值。不赋值的时候一般被构造函数初始化赋值,其值用来保存类实例的数据,可以被内部方法使用作为计算的数据来源。当需要继承类继承本类的时候,field要改为protected类型,这样继承类时子类可以对基类的field有完全访问权。property一般为public,是向外暴露的窗口,属性可以为其他外部类使用。方法可以是public的,用来向外暴露,外部可以直接调用。继承如果子类继承于父类,第一:子类拥有父类非private的属性和功能;第二:子类具有自己的属性和功能,即子类可以扩展父类没有的属性和功能;第三:子类还可以以自己的方式实现父类的功能 阅读全文
posted @ 2013-06-20 10:12 若愚Shawn 阅读(380) 评论(0) 推荐(0) 编辑
摘要: - System.IO.FileInfo- System.IO.DirectoryInfo MSDN- System.IO.Directory- System.IO.FileView Code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace ConsoleApplication3 { class Program { stat... 阅读全文
posted @ 2013-06-16 11:14 若愚Shawn 阅读(382) 评论(0) 推荐(0) 编辑
摘要: Field initializers赋值可以直接给值,也可以是对象。建议不直接给filed initialzer赋值,当继承的时候会出现顺序的怪异问题:解决方法:在constructor里给filed赋值注意如果是继承类,自己ctor之前先要ctor基类。叫public Person()的时候会先跳到上面的基类public Base()先。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleA 阅读全文
posted @ 2013-06-15 16:09 若愚Shawn 阅读(275) 评论(0) 推荐(0) 编辑
摘要: Nested typesClass和Structure里可以nest任意多的类型(包括class),但是Enum里不可以。class{ enum ParserState { }}Class Person{ Class Room{} enum GunType{}}View Code Access modifiersInternal:只包在本assemble(ClassLibrary编译后是dll,ConsoleApplication16编译后是exe文件,这是两个独立的Assembly)里使用。 其他Assembly不可见。上面ClassLibrary1是一个cla... 阅读全文
posted @ 2013-06-15 12:16 若愚Shawn 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 问题外层MainWindow.xaml里有一个Container(ContentPresenter),调用一个CreateJob 页面,里面是一行行的,最后一个是。因为会调用不同的子页面,这个Containner(ContentPresenter)需要写清TabNavigation的方式,这里是Local而里面这些Textblock设置了一定顺序的Index,最后一个是的index是最大的。但是这个datapicker是由一个DataTemplate组成的,其再内层是一个TextBlock和一个Button组成。问题是KeyboardTab不会走到内层的DataPicker的Button中。解 阅读全文
posted @ 2013-06-12 15:11 若愚Shawn 阅读(696) 评论(0) 推荐(0) 编辑
摘要: Binary File Operationhttp://blog.sina.com.cn/s/blog_6f7e825501015ogy.htmlhttp://www.mzwu.com/article.asp?id=2364http://blog.csdn.net/longge7685/article/details/4620893StreamWriter & StreamReader最简单的实例:using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Te 阅读全文
posted @ 2013-06-03 16:17 若愚Shawn 阅读(561) 评论(0) 推荐(0) 编辑
摘要: WPF学习:5.依赖属性 前一章主要介绍了类型扩展和标记转换,这一章主要介绍WPF中一个重要的特性-依赖属性。按照惯例,先贴上示例代码:http://files.cnblogs.com/keylei203/5.BindingDP.zip。一个新的属性系统 依赖属性的设计思想就是侧重于属性超过方法和事件,能用属性解决的问题解决不使用方法和事件,以往的属性功能太单一,仅仅是提供一个类型的值,WPF提供了一个新的属性类型即依赖属性和与之配套的服务,让它能做方法和事件所能做的事情。 依赖属性和一般的CLR属性大部分相似,那么这种新的属性系统的优势在哪里呢,下面让我们看看依赖属性和CLR属性的区别... 阅读全文
posted @ 2013-05-28 10:55 若愚Shawn 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 一、普通属性首先我们来探讨下.NET里面的属性,我们平时写一个类的时候我们需要定义一些字段来保存一些值。public class Person{ public string nam; public int age;}但是我们会发现,这样子定义的话不能满足我们的需求,比如说我们需要实现一些对字段值得验证限制什么的,这时候我们就需要属性来为我们实现了。因为我们能在给属性设置的时候编写我们的验证逻辑。public class Person{ private string name; private int age; public int Age { get{retur... 阅读全文
posted @ 2013-05-28 10:40 若愚Shawn 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 简介 一个绑定常常由四部分组成:绑定源、路径、绑定目标及目标属性,同时转换器也是一个非常重要的组成。源用来标示源属性所存在的类型实例,路径用来标示需要绑定到的处于绑定源之上的源属性,绑定目标标示将接受相应更改的属性所在的实例,目标属性则用来标示接受绑定运行值的目标,而转换器则在源属性和目标属性不能直接赋值时执行转化工作。 这四部分组成之间的联动方式为:绑定源发出属性更新的通知,从而驱动绑定执行。其中源属性将作为绑定的输入,而绑定的输出则被赋予目标属性。如果绑定声明中标明了转换器,那么转换器将被执行,从而将源属性转化为合适 的目标属性。除了这些组成之外,绑定还常常使用转换器参数,绑定模式等各.. 阅读全文
posted @ 2013-05-26 17:36 若愚Shawn 阅读(452) 评论(0) 推荐(0) 编辑
摘要: Binding中使用RelativeSource问题:当前View有一个DataGrid,其DataGridTemplateColum设置了一个ComboBox。其对应的VM是local:ViewMode,含有ModelValue和myLIst属性分别用来做DataGrid的ItemSource,和ComboBox的ItemSource。外层内层看起来链接的VM层不同的property。初始代码如下:<DataGrid ItemsSource="{Binding ModelValues, Mode=TwoWay, UpdateSourceTrigger=PropertyChan 阅读全文
posted @ 2013-05-26 16:36 若愚Shawn 阅读(702) 评论(0) 推荐(0) 编辑
摘要: 4 kinds of RelativeSourcemode(MSDN)Self:If you want to bind to another property on the object:{Binding Path=PathToProperty, RelativeSource={RelativeSource Self}} Imagine this case, a rectangle that we want that its height is always equal to its width, a square let's say. We can do this using the 阅读全文
posted @ 2013-05-23 18:07 若愚Shawn 阅读(366) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/5584948/format-date-time-in-xaml-in-silverlighthttp://matthiasshapiro.com/2010/05/28/silverlight-4-binding-and-stringformat-in-xaml/http://www.codeproject.com/Articles/195436/Formatting-text-in-Silverlight-XAML-using-StringFohttp://msdn.microsoft.com/en-us/library/ 阅读全文
posted @ 2013-05-23 16:15 若愚Shawn 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 创建Resource的时候我们一般在本Solution根目录下右键创建新的resource文件,is just a collection of any typed objects, not elements.比如:1 <LinearGradientBrush EndPoint="1,0" x:Key="brush1">2 <GradientStop Color="Yellow" Offset="0" />3 <GradientStop Color="Orange" 阅读全文
posted @ 2013-05-14 15:18 若愚Shawn 阅读(1062) 评论(0) 推荐(0) 编辑
摘要: Wilma项目中的例子:View Code 1 16 17 18 19 20 21 其中TargetNullValue和Binding的Path指定的后台property做对应,当后台pro... 阅读全文
posted @ 2013-05-09 16:14 若愚Shawn 阅读(596) 评论(0) 推荐(0) 编辑
摘要: http://broadcast.oreilly.com/2010/09/understanding-c-equality-iequa.html 阅读全文
posted @ 2013-05-09 09:45 若愚Shawn 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 赋值1:View Code 1 using System; 2 3 class ComplexNumber 4 { 5 public double Real { get; set; } 6 public double Imaginary { get; set; } 7 8 public override string ToString() 9 {10 return String.Format("{0}{1}{2}i", 11 Real, 12 Imaginary >= 0... 阅读全文
posted @ 2013-05-09 09:06 若愚Shawn 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 时刻提醒自己是否这个类或者方法符合SRP,我们需不需要把其分成小份的?single responsibility principle states that every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.View Code 1 using System; 2 usin. 阅读全文
posted @ 2013-05-08 15:28 若愚Shawn 阅读(599) 评论(0) 推荐(0) 编辑
摘要: interface实现polymophersonView Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using TryCollection.Abstract; 6 7 namespace TryCollection 8 { 9 class Engine10 {11 private IState _state;12 public IState State13 {14 ... 阅读全文
posted @ 2013-05-08 10:08 若愚Shawn 阅读(202) 评论(0) 推荐(0) 编辑
摘要: Bool?属性切换不同控件方法1:换整个某个Custom的control的整个Template可以用DataTemplate的DataTrigger,用在collection里(ListView/DataGrid),特点是在Template外面,换Template例子:主要是换自定义的,用换在DT里的TemplateView Code ... 阅读全文
posted @ 2013-05-06 10:30 若愚Shawn 阅读(688) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-05-05 17:28 若愚Shawn 阅读(122) 评论(0) 推荐(0) 编辑
摘要: is: return true or falseView Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication6 7 { 8 abstract class Purchasedable 9 {10 11 }12 abstract class Moveable : Purchasedable13 {14 15 }16 abstrac... 阅读全文
posted @ 2013-04-25 11:14 若愚Shawn 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Abstract的问题:Abstract也许看上去优美,有一般methrod,virtual methord,或者abstract metho 1 abstract class Car 2 { 3 abstract public void tALK(); 4 public void Drive() 5 { 6 Console.WriteLine("WROOOOOOM"); 7 } 8 public virtual void TruboBosst() 9 {10 ... 阅读全文
posted @ 2013-04-25 10:40 若愚Shawn 阅读(211) 评论(0) 推荐(0) 编辑
摘要: C# API有这样的功能:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication5 7 { 8 abstract class Person 9 {10 private string _name;11 public string Name12 {13 get { return _name; ... 阅读全文
posted @ 2013-04-24 16:07 若愚Shawn 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 一个类如果没有构造那么系统为我们在背后创建一个0参数的构造,但是一旦我们创建了但参数的构造,那么默认的构造就没了。View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication4 7 { 8 class Person 9 {10 private string _name;11 public Person(string name)12 ... 阅读全文
posted @ 2013-04-23 21:55 若愚Shawn 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Property一般用来给field赋值:View Code 1 private string _name2 public string Name3 {4 get{return _name;}5 set{_name = value;}6 }可以给Field赋值的不只是property,也可以是constractor或者一个方法,但是如果我们想要向外暴露这个filed我们才需要写propertyView Code 1 class Person 2 { 3 private string _name 4 public Person(string name) 5 ... 阅读全文
posted @ 2013-04-23 21:52 若愚Shawn 阅读(249) 评论(0) 推荐(0) 编辑
摘要: View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication3 7 { 8 abstract class EvenNumberGenerator 9 {10 public void Run(int min, int max)11 {12 for (int i = min; i < max; i++)13 ... 阅读全文
posted @ 2013-04-20 19:21 若愚Shawn 阅读(219) 评论(0) 推荐(0) 编辑
摘要: View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication2 7 { 8 abstract class Item 9 {10 public abstract void Dispaly();11 public abstract void Use();12 }13 class Chair : Item14 {15... 阅读全文
posted @ 2013-04-20 17:06 若愚Shawn 阅读(346) 评论(0) 推荐(0) 编辑
摘要: Virtual memebers:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{ class Person { public string Firstname { get; set; } public string SecondName { get; set; } public virtual void Display() { C... 阅读全文
posted @ 2013-04-15 15:00 若愚Shawn 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 我们知道,一个类的方法从调用方式上可以分为“静态方法”与“非静态方法”(实例方法)。在.net框架中,也有很多这种公共静态方法。现在我想讨论一下,一个类为什么要提供静态方法以及在什么时候应该提供静态方法。静态方法与非静态方法最明显的区别就是如果某个方法是公共静态的,那么可以直接 通过类名.方法名的方法来调用,而公共实例方法则需要事先实例化对象,然后才能调用。很多人认为静态方法来速度上、在内存占用比值上要比实例方法快和多, 这一点我不认同。方法执行的快与慢在同等条件下主要决定于所要进行的操作,而静态方法要比实例方法占用更多的内存这一点更是毫无根据。一个类型加载的时 候,该类的所有的方法都会被加载 阅读全文
posted @ 2013-04-15 11:19 若愚Shawn 阅读(2171) 评论(0) 推荐(0) 编辑
摘要: One question that has been coming up frequently over the past few days has been how to launchthe browserwhen the user clicks on a hyperlink. The answer is different for thebrowser and standalone cases:Browser (XBAP or Loose XAML)XBAPs and looseXAMLsupport special named targets for Hyperlink; these a 阅读全文
posted @ 2013-04-11 15:21 若愚Shawn 阅读(2888) 评论(0) 推荐(0) 编辑
摘要: ModelM_Object{ A B}ViewShow_AShow_BSave_Button VModelVM_A binding to Show_AVM_B binding to Show_BVM_Object{M_Object ownObject;property VM_A {get; set;}property VM_B {get; set;}}void Save(){M_Object.A = VM_A;M_Object.B = VM_B;}void Load() //initialize Model call load function{VM_A = M_Object.A;VM_B = 阅读全文
posted @ 2013-03-19 23:47 若愚Shawn 阅读(196) 评论(0) 推荐(0) 编辑