2009年3月10日

combo box bind to IEnumerable

摘要: public class XXXType : IEnumerable{public string SetType = "Set XXXX";public string NoXXX = "No XXXX;public string Year= "Year";public string Month= "... 阅读全文

posted @ 2009-03-10 19:22 oyl 阅读(169) 评论(0) 推荐(0) 编辑

2009年3月9日

Style based on a type

摘要: Style.BasedOn = {StaticResource "{X:Type my:XXXControl}"} 阅读全文

posted @ 2009-03-09 16:43 oyl 阅读(133) 评论(0) 推荐(0) 编辑

2009年1月17日

X.509数字签名

摘要: Zju.GUI.App_TemporaryKey.pfx文件:公钥加密技术12号标准(Public Key Cryptography Standards #12,PKCS#12)为存储和传输用户或服务器私钥、公钥和证书指定了一个可移植的格式。它是一种二进制格式,这些文件也称为PFX文件。开发人员通常... 阅读全文

posted @ 2009-01-17 20:02 oyl 阅读(1743) 评论(0) 推荐(0) 编辑

MVC,MVP,MVVM(model-view-viewModel

摘要: 一.What is MVCA model is an object representing data or even activity, e.g. a database table or even some plant-floor production-machine process.A view... 阅读全文

posted @ 2009-01-17 17:18 oyl 阅读(1039) 评论(0) 推荐(0) 编辑

2009年1月4日

ItemsControl.filter

摘要: ItemsControl.Items.Filter = new Predicate(SetFilter);private bool SetFilter(object de){m_FilterCount++;Notification noti = de as Notification;if (noti... 阅读全文

posted @ 2009-01-04 21:16 oyl 阅读(273) 评论(0) 推荐(1) 编辑

Helper methods

摘要: ////// Attempts to find the child framework element recursively from a given parent root object.//////the parent root object///the name of the child e... 阅读全文

posted @ 2009-01-04 16:29 oyl 阅读(464) 评论(5) 推荐(0) 编辑

2008年12月25日

Layout相关

摘要: 1. 获得一个控件相对于另一个控件的位置//Vector vector = VisualTreeHelper.GetOffset(relativeControl);//Canvas.SetLeft(this,vector.X);//Canvas.SetTop(this, vector.Y);//UI... 阅读全文

posted @ 2008-12-25 20:01 oyl 阅读(245) 评论(0) 推荐(0) 编辑

动画相关

摘要: board.FillBehavior = FillBehavior.Stop 让动画结束后退出对目标属性的管理,这样目标属性的binding,set value 才能正常进行。 阅读全文

posted @ 2008-12-25 19:50 oyl 阅读(127) 评论(0) 推荐(0) 编辑

2008年12月16日

UIElement.CaptureMouse() and Mouse.Capture()

摘要: Capture mouse能够使 即使在控件之外也能够获取鼠标事件,拖,拉鼠标时最有用。When an element captures the mouse, it receives mouse input whether or not the cursor is within its border... 阅读全文

posted @ 2008-12-16 16:59 oyl 阅读(541) 评论(0) 推荐(0) 编辑

2008年12月5日

event handler in DataTemplate

摘要: 在user control中,给data template加event handler很容易,因为user control的xaml是与cs编译成一个类, 有x:class tag. 但是在custom control 中,必须代码加入,而且要用visual tree找到data template中... 阅读全文

posted @ 2008-12-05 13:36 oyl 阅读(355) 评论(0) 推荐(0) 编辑

2008年11月30日

获得default control template of a control

摘要: 方法有使用xamlpadX,blend工具, 还有用程序:privatestring GetDefinitionOfControlTemplate(ControlTemplate template) { XmlWriterSettings settings = newXmlWriterSettin... 阅读全文

posted @ 2008-11-30 14:11 oyl 阅读(171) 评论(0) 推荐(0) 编辑

获得DateTemplate中的element

摘要: 比较困难的是用DataTemplate.FindName(string name,parent),需要知道这个datatemplate visual tree中的直系父亲,只要就是查找这个父亲了。例子: ItemsControl通过ItemContainerGenerator产生items,... 阅读全文

posted @ 2008-11-30 13:51 oyl 阅读(507) 评论(1) 推荐(0) 编辑

2008年11月28日

UserControl的trigger

摘要: 1. 例子:targetType设置好就能够直接使用 user control中定义的 dependency property 2. 对于user control内部的element,要使用user control的property,最好就用binding,如:3. Style.Trigger 中的... 阅读全文

posted @ 2008-11-28 13:11 oyl 阅读(429) 评论(0) 推荐(0) 编辑

2008年11月20日

DispatcherSynchronizationContext and Dispatcher

摘要: SynchronizationContext提供一个自由线程的同步上下文,一个常用的用法是把UI线程的同步上下文保存起来,传给另一个线程,因为UI只能再UI线程中操作,在另外一个线程,用SynchronizationContext把操作跳转到UI线程。SynchronizationContext.... 阅读全文

posted @ 2008-11-20 19:23 oyl 阅读(1243) 评论(4) 推荐(0) 编辑

2008年11月19日

Exception of Storyboard in controlTemplate,can't use binding or dynamic resource

摘要: msdn:http://msdn.microsoft.com/en-us/library/ms742868.aspxThe TargeName may only refer to child objects of the ControlTemplate. If TargeName is not sp... 阅读全文

posted @ 2008-11-19 09:37 oyl 阅读(236) 评论(0) 推荐(0) 编辑

2008年11月18日

When use registerReadonly

摘要: 使用:internal static readonly DependencyPropertyKey AquariumSizeKey = DependencyProperty.RegisterReadOnly( "AquariumSize", typeof(double), typeof(Aquari... 阅读全文

posted @ 2008-11-18 12:23 oyl 阅读(189) 评论(0) 推荐(0) 编辑

2008年11月16日

Some tips

摘要: 1. UIPropertyMetadata and FrameworkPropertyMetadataUIPropertyMetaData Provides property metadata for non-framework properties that do have rendering/u... 阅读全文

posted @ 2008-11-16 22:37 oyl 阅读(328) 评论(0) 推荐(0) 编辑

2008年11月1日

(转WPF SDK)Popup my Control

摘要: http://blogs.msdn.com/wpfsdk/archive/2007/04/27/popup-your-control.aspxPopup your controlYou want a custom control to behave like a Popup and appear o... 阅读全文

posted @ 2008-11-01 13:53 oyl 阅读(827) 评论(0) 推荐(0) 编辑

2008年10月30日

WPF 异步编程

摘要: DispatherObject很多wpf 对象有线程相关性(thread affinity),意味在你只能在创建它的线程上使用它。这和window form的UI控件一样。 WinForm的control.invoke() ,winform.timer 会在进行UI操作时做一个线程切换。在wpf中,... 阅读全文

posted @ 2008-10-30 00:59 oyl 阅读(1463) 评论(0) 推荐(0) 编辑

2008年10月29日

WPF 调试方法, WPF Debug

摘要: WPF debug:一.Output window 输出:System.Windows.Data Error: 35 : BindingExpression path error: 'Full' property not found on 'object' ''FileInfo' (HashCode... 阅读全文

posted @ 2008-10-29 12:36 oyl 阅读(3289) 评论(0) 推荐(0) 编辑

2008年10月28日

.net反射解析dll时 关联dll的加载

摘要: 问题:一个解析器:using System;using System.Reflection;using System.Collections.Generic;using System.Text;classProgram{ staticvoid Main(string[] args) { string... 阅读全文

posted @ 2008-10-28 13:07 oyl 阅读(1121) 评论(0) 推荐(0) 编辑

2008年10月21日

wcf 跟踪和消息日志记录 :http://msdn.microsoft.com/zh-cn/library/ms751526.aspx

摘要: 启用跟踪和消息日志记录。生成的跟踪和消息日志可以使用service tracer viewer查看:在 WCF 中,可通过设置服务模型跟踪源 switchValue 并将下面的代码添加到服务或客户端的配置文件中来实现此目的: 复制代码 ... 阅读全文

posted @ 2008-10-21 20:18 oyl 阅读(430) 评论(0) 推荐(0) 编辑

(转)WPF性能优化点 http://www.cnblogs.com/YilingLai/archive/2007/01/19/624714.html

摘要: 在建立漂亮UI的同时,我们还需要关注应用程序的性能,WPF尤其如此。下面从MS的文档中总结出了一些有用的性能优化点。在实际编写的过程中,可以参考。这个Post非完全原创,是根据一些文档总结出来的。1、建立逻辑树的时候,尽量考虑从父结点到子结点的顺序构建。因为当逻辑树的一个结点发生变化时(比如添加或删... 阅读全文

posted @ 2008-10-21 19:58 oyl 阅读(309) 评论(1) 推荐(0) 编辑

System.Windows.Markup.ContentPropertyAttribute

摘要: MSDN:http://msdn.microsoft.com/en-us/library/system.windows.markup.contentpropertyattribute.aspxWhen implementing a content property of a collection t... 阅读全文

posted @ 2008-10-21 19:03 oyl 阅读(297) 评论(0) 推荐(0) 编辑

2008年10月20日

如何处理frozon control (WPF FAQ http://www.syncfusion.com/faq/wpf/default.aspx#60)

摘要: 将一个control freeze后能够提高其性能。If you try to modify a frozen Freezable object, it throws an 'Invalid Operation' Exception. To avoid throwing this exception... 阅读全文

posted @ 2008-10-20 15:22 oyl 阅读(195) 评论(0) 推荐(0) 编辑

Enumerate the visual tree and logic tree

摘要: How can I enumerate all the descendants of a visual object ? You can enumerate all the descendants of a visual object as follows :// Enumerate all the... 阅读全文

posted @ 2008-10-20 15:20 oyl 阅读(330) 评论(0) 推荐(0) 编辑

不能获得一个routed event 有多少个event handler

摘要: 原来的普通eventHandler可以通过eventHandler clickHandler;clickHandler.GetInvocationList().Length 来获得foreach(delegate a in GetclickHandler.GetInvocationList()){}... 阅读全文

posted @ 2008-10-20 12:38 oyl 阅读(239) 评论(0) 推荐(0) 编辑

注意:匿名事件处理函数

摘要: if (button != null && button.m_defaultMenuItem != menuItem) {button.m_defaultMenuItem.IsEnabledChanged += delegate(object o, DependencyPropertyChanged... 阅读全文

posted @ 2008-10-20 12:27 oyl 阅读(151) 评论(0) 推荐(0) 编辑

2008年10月15日

What is the difference between ContentPresenter and ContentControl?

摘要: If you look at these two classes in reflector, you will notice the main difference between them: ContentControl derives from Control, and ContentPrese... 阅读全文

posted @ 2008-10-15 15:02 oyl 阅读(561) 评论(0) 推荐(0) 编辑

What is the difference between Binding and TemplateBinding?

摘要: Binding provides much more flexibility than TemplateBinding, but it’s more costly. TemplateBinding is limited to one scenario but very efficient in wh... 阅读全文

posted @ 2008-10-15 15:01 oyl 阅读(454) 评论(0) 推荐(0) 编辑

What is the difference between CollectionView and CollectionViewSource?

摘要: The short answer is that CollectionView is a view and CollectionViewSource is not. Every time you bind an ItemsControl directly to a collection, we cr... 阅读全文

posted @ 2008-10-15 14:58 oyl 阅读(459) 评论(0) 推荐(0) 编辑

2008年10月14日

(转)在WPF中自定义控件 CustomControl (下)注意TemplatePartAttribute

摘要: 1, 控件UI部分与逻辑部分的耦合.这是一个容易被忽略但却非常重要的问题,我们之所以使用CustomControl而不是UserControl,是因为我们希望自己的控件能向WPF内置控件一样,其UI能轻易地被其他用户定制或我们将来所改变.也就是说其视觉树不能与后台逻辑纠缠在一起,因为其视觉树中的元素... 阅读全文

posted @ 2008-10-14 19:56 oyl 阅读(838) 评论(0) 推荐(0) 编辑

(转)在WPF中自定义控件 CustomControl (上)

摘要: 1,新建CustomControl在选择控件基类后,第一件事情便是在你的项目中新建"CustomControl",我们会发现在项目中自动生成了一个*.CS(或*.VB或其他)文件以及\Themes\Generic.xaml(如果原来没有的话),他们分别是CustomControl的后台代码文件(Co... 阅读全文

posted @ 2008-10-14 19:53 oyl 阅读(514) 评论(0) 推荐(0) 编辑

2008年10月13日

How to get the control inside the ControlTemplate/DataTemplate on run time.

摘要: Here is a similar example to get control inside DataTemplate at runtime.XAML code: In the code behind: public partial class Window1 : W... 阅读全文

posted @ 2008-10-13 21:48 oyl 阅读(658) 评论(0) 推荐(0) 编辑

wpf isEnabled属性从其container继承下来的问题

摘要: Let's suppose we have the following xaml: Although the TextBox's IsEnabled property is set to true it will inherit it's value from it's container, in ... 阅读全文

posted @ 2008-10-13 21:39 oyl 阅读(704) 评论(0) 推荐(0) 编辑

2008年9月22日

EssentialWPF_chapter6_Data

摘要: Resource:Static Resources is static assignment, just can be used once.Dynamic resource The lookup path for resources is1. Element hierarchy2. Applicat... 阅读全文

posted @ 2008-09-22 19:54 oyl 阅读(229) 评论(0) 推荐(0) 编辑

2008年9月11日

C++里面多继承带来的指针漂移问题

摘要: C++里面多继承带来的指针漂移问题C++里面多继承带来的指针漂移问题转载请注明出处:http://blog.csdn.net/phoenixsh最近我们在工作中碰到一个奇怪的问题,最后确定是多继承引起的指针漂移,跟C++对象模型有关。示意如下:classA...{...};classB...{...... 阅读全文

posted @ 2008-09-11 00:39 oyl 阅读(989) 评论(0) 推荐(0) 编辑

2008年8月24日

.net Thread process UI

摘要: 假设线程A创建了窗口W,同时为了工作需要线程A有创建了工作线程B。 STA中,对窗口W中与UI(界面)相关属性的修改,必须在创建窗口的线程A中完成。换句话说,线程B不允许修改W的UI属性(否则抛出InvalidOperationException,消息“Control control name ac... 阅读全文

posted @ 2008-08-24 18:15 oyl 阅读(382) 评论(0) 推荐(0) 编辑

[STAThread]的含义

摘要: [STAThread]STAThread:Single Thread Apartment Thread.(单一线程单元线程)[]是用来表示Attributes;[STAThread]是一种线程模型,用在程序的入口方法上(在C#和VB.NET里是Main()方法),来指定当前线程的ApartmentS... 阅读全文

posted @ 2008-08-24 16:53 oyl 阅读(235) 评论(0) 推荐(0) 编辑

STA thread

摘要: C#程序的主函数写[STA Thread] 属性是什么目的?(What is the purpose of the [STA Thread] attribute for the Main method of a C# program? )C#中,[STAThread]代表什么意思?如何用?> Sin... 阅读全文

posted @ 2008-08-24 16:50 oyl 阅读(904) 评论(0) 推荐(0) 编辑

导航