标签 WPF

WPF Border

<Border BorderBrush=”AliceBlue” Margin=”10 10 0 10″ BorderThickness=”1″>

WPF ComboBox

<ComboBox Name=”cbb”/> IsEditable=”True” 下拉框可编辑 cbb.Items.Insert(0,”aa”); cbb.Items.Insert(1, …

WPF COM组件

右键解决方案增加 用户控件(非wpf那个) UserControl1 工具栏选择项增加WMP控件,将控件拖入UserControl1的窗口 UserControl1的cs文件中加入接口函数 publi…

WPF DataGrid

数据绑定 combox相关资源定义 xmlns:core=”clr-namespace:System;assembly=mscorlib” <Window.Resources> <O…

WPF DatePicker

<DatePicker x:Name=”datePickerCtl” Width=”200″ Height=”25″ SelectedDateFormat=”Long” FirstDayOfWe…

WPF Expander

<Expander IsExpanded=”True” Header=”Item1″ BorderBrush=”{x:Null}”> </Expander>

WPF Grid

GD.ColumnDefinitions.Clear(); GD.ColumnDefinitions.Add(new ColumnDefinition()); GD.ColumnDefinitions…

WPF Image

ActualWidth属性表示显示图像后,控件实际的宽度,五图像时该值为0 加载图像路径 img.Source = new BitmapImage(new Uri(@”D:1.jpg&#8…

WPF Label

<Label Name=”Label1″ Content=”xxxxx” FontSize=”40″ FontFamily=”Georgia” FontWeight=”Bold”/> 设置…

WPF ListBox

Item可以是字符串,也可以是任意类型视图控件 <ListBox Name=”listbox1″ ></ListBox> 添加方法1 listbox1.Items.Add(1)…

WPF ListView

` <ListView.View> <GridView> <GridViewColumn Header=”姓名” Width=”150″ x:Name=”ColName…

WPF mediaElement

<MediaElement Name=”mediaElement1″ Stretch=”Fill” LoadedBehavior=”Manual” /> 删除标签中的margin,可以实现…

WPF RadioButton

使用 <StackPanel Orientation=”Horizontal”> <RadioButton x:Name=”A” Content=”A”/> <Radio…

WPF RichTextBox

<RichTextBox Name=”rr” VerticalScrollBarVisibility=”Auto”/> rr.Document.Blocks.Add(new Paragra…

WPF ScrollViewer

自动扩展容器内的内容排版 <ScrollViewer Focusable=”False” HorizontalScrollBarVisibility=”Disabled” VerticalScr…

WPF Slider

sl.Minimum= 0; sl.Maximum= 255; ValueChanged Slider sl = sender as Slider; int val = (int)sl.Value;

WPF Separator

<Separator Style=”{StaticResource {x:Static ToolBar.SeparatorStyleKey}}” Margin=”0,8″ BorderBrush…