随笔分类 - C#
摘要:参考 Three steps for fast entityframework 6.1 code-first startup performance Managing DbContext the right way with Entity Framework 6: an in-depth guide
阅读全文
摘要:Multithreaded UI: HostVisualCreating a Busy Indicator in a separate thread in WPF
阅读全文
摘要:示例 参考 WPF combobox SelectedValue binding to string Confused with wpf ComboBox DisplayMemberPath,SelectedValue and SelectedValuePath
阅读全文
摘要:Stackpanel: Height vs ActualHeight vs ExtentHeight vs ViewportHeight vs DesiredSize vs RenderSize
阅读全文
摘要:I want to share this great post from Anoop that shows a easy way to add a notification system to dependency properties of a given element. It creates and attaches a new property to the existing proper...
阅读全文
摘要:So far, we worked with styles by setting a static value for a specific property. However, using triggers, you can change the value of a given property
阅读全文
摘要:Download Solution ShadowedTextBoxExample.zip (70.3 KB) Usage Styles ShadowedTextBox.cs using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Window...
阅读全文
摘要:简介 通常我们想对现有的控件,做些修饰时我们就会想到一个装饰模式。WPF中也提供了这样的实现思路:通过将Adorner添加到AdornerLayer中来实现装饰现有控件的效果。如图示: 本来TextBox四角没有圆点,但是通过装饰器可以为它加上。所以可以看成在TextBox上加了层。 这样就“无痛”的给控件进行了装饰(如果不想要,还可以随时拆掉,哈哈)。当然应用不单...
阅读全文
摘要:简介项目中经常会用到,同步两个控件的值,本文就简单列举两种方式来同步不同控件的两个Dependency Property。示例效果图:只使用C#代码://获取slider1的ValueDependency property的值var binding = new Binding(){ Eleme...
阅读全文
摘要:项目经常前台界面涉及到用户输入时,我们常常会用到数据有效性的验证。在网页中我们之前用js来校验Form中的数据有效性。在WPF中我们如何实现这种验证机制了?答案:INotifyDataErrorInfo INotifyDataErrorInfo简介 如图示该接口有三件宝贝: HasErrors: a read-only boolean property which tel...
阅读全文
摘要:事件只能在它被声明的声明空间(类)中使用,不能从任何其他类引发,即使该类是事件所在类的继承类。
阅读全文
摘要:探讨: 1、当引用资源时,选择StaticResource还是DynamicResource的考虑因素: (1)在哪里创建资源?(资源的范围或层级) a. 资源是在一个Page/Canvas/Window中? b. 在应用程序范围中? c. 在松散的Xaml中? d. 在某个特定的Object(比如某个特定的Button)中? 物件级:此时,资源只能套用在...
阅读全文
摘要:在XAML中如何使用表达式。
阅读全文
摘要:在资源文件中指定宽度和高度
阅读全文
摘要:WPF中常用到TextBlock。这里就常用的功能简介,以及一些注意事项介绍。
阅读全文
摘要:WPF LIstBox 常用简介,以及相关的自定义模板和Style
阅读全文
摘要:public class EnumerationDataProvider : ObjectDataProvider
{ public Type EnumerationType { get; set; } public string NoneValue { get; set; } public string NoneDisplayValue { get; set; ...
阅读全文
摘要:引言 即使 ItemsControl 不是 DataTemplate 所用于的唯一控件类型,将 ItemsControl 绑定到集合仍然很常见。 在 DataTemplate 中有哪些内容一节中,我们讨论了您的 DataTemplate 定义应当仅与数据表示相关。 为了明确何时不适合使用 DataTemplate,有必要了解 ItemsControl 提供的不同样式和模板属...
阅读全文