随笔分类 - WPF
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Windows;using System.Windows.Input;using System.Windows.Markup;using System.Windows.Media;using System.Windows.Threading;using Drawing = System.Drawing;using Forms = System.Windows.Forms;namespace WpfApplication1{
阅读全文
摘要:Expender 在展开时,Header 不展示;不展开时,展示 Header ...
阅读全文
摘要:方法一:使用代码 #region Command private void HelpCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; } private void HelpExecuted(object sender, ExecutedRoutedEventArgs e) { System.Diagnostics.Process.Start("htt...
阅读全文
摘要:OutAdmissionBookingEditor admissionBookingEditor = this.LayoutManager.OpenDialog ( this.GetResourceText("ResAdmissionBooking"), null, this.ActualWidth * 0.7, new object[] { "modification", res[0], this.functi...
阅读全文
摘要:StackPanel 的 HorizontalAlignment 属性和 VerticalAlignment 属性 默认情况下,这两个属性都被设置为 Stretch.
阅读全文
摘要:1.删除 Width 和 Height 属性;2.将 Windows.SizeToContent 属性设置为 WidthAndHeight这时窗口就能自动调整自身大小,从而容纳所包含的内容。通过将 Windows.SizeToContent 属性设置为 Width 或 Hight ,可以使窗口只能在一个方向上改变自身大小。
阅读全文
摘要:Border: Button: 使用 ButtonChrome 装饰元素获取特有的圆角和阴影背景效果。ListBox 使用 ListBoxChrome 装饰元素。
阅读全文
摘要:*.GridSplitter属性是Grid面板的一个特性。(1)预留一行或一列,专门用于放置 GridSplitter对象,如果是行的话,把其Height 设置为 Auto,如果是列的话,把其 Width 设置为 Auto。(2)拉伸整行或整列,使其穿越整行或整列;使用RowSpan或ColumnSpan;(3)为 GridSplitter 设置最小尺寸,垂直分隔的话,设置 Width 为一个固定值,并将VerticalAlignment="Stretch";水平分隔的话,设置Height 为一个固定值,并将 HorizontalAlignment="Stretc
阅读全文
摘要:#依赖属性的用法与普通属性相同;#只能为依赖对象(继承自 DenpendencyObject的类)1)定义public static readonly DependencyProperty XXXProperty;
阅读全文
摘要:tbName.SetValue(Grid.RowProperty, 1);
阅读全文
摘要:(1)img.MouseUp+= img_MouseUp;(2)调用 UIElement.AddHandler()直接连接事件;img.AddHandler(Image.MouseUpEvent, new MouseButtonEventHandler(img_MouseUp));(3)使用定义事件的类的名称,而不是引发事件的类的名称;img.AddHandler(UIElement.MouseUpEvent, new MouseButtonEventHandler(img_MouseUp));缺点:不能很明确地指明事件是由Image类提供的
阅读全文
摘要:1.Set the TabIndex="16"2. private void detailGrid_Keydown(object sender, KeyEventArgs e) { try { if (e.Key == Key.Enter) { TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Next); ...
阅读全文
摘要:this.tbContent.Document.Blocks.Clear();
阅读全文
摘要:...
阅读全文
摘要:1.用在textbox等输入控件上,验证输入是否合法。首先定义一个Converter,2.Xaml里面这样子写,意思是输入的数字,如果小于100则显示为红色。3.combox等列表控件里面,也可以用做数据筛选。下面例子中筛选出小于100的项目,红色显示数据源定义为:Xaml:
阅读全文
摘要:1.定义一个全局资源文件,如下 2.使用1)引入命名空间:2)控件上使用
阅读全文