摘要: 说明:在数据绑定时,如果有些字段为空值,那么在数据绑定时可以用默认值来显示为空的字段。 1 <Grid> 2 <ListBox x:Name="lstPeople" Width="400"> 3 <ListBox.ItemTemplate> 4 <DataTemplate> 5 <StackPanel Orientation="Horizontal"> 6 <TextBlock Text="{Binding Path=FirstNam... 阅读全文
posted @ 2012-04-06 17:22 January 阅读(4977) 评论(1) 推荐(0) 编辑
摘要: 1 2 <Window x:Class="MainWindow" 3 Loaded="Window_Loaded"> 4 5 <ListBox x:Name="lstPeople" Width="200"> 6 <ListBox.ItemTemplate> 7 <DataTemplate> 8 <StackPanel> 9 <StackPanel Orientation="Horizontal">10 ... 阅读全文
posted @ 2012-04-06 17:09 January 阅读(2235) 评论(0) 推荐(0) 编辑
摘要: <Window.Resources> <DrawingImage x:Key="OverlayImageVector"> <DrawingImage.Drawing> <GeometryDrawing Brush="Red"> <GeometryDrawing.Geometry> <RectangleGeometry Rect="0 0 16 16" RadiusX="3" RadiusY="3" /> ... 阅读全文
posted @ 2012-04-06 16:56 January 阅读(2867) 评论(1) 推荐(1) 编辑
摘要: 1 <Window.TaskbarItemInfo> 2 <TaskbarItemInfo /> 3 </Window.TaskbarItemInfo> 4 5 <Grid> 6 <ProgressBar x:Name="ProgressBar" Margin="10" 7 HorizontalAlignment="Stretch" 8 VerticalAlignment="Center" 9 Height... 阅读全文
posted @ 2012-04-06 16:32 January 阅读(2121) 评论(0) 推荐(0) 编辑
摘要: 1 namespace Easing2 2 { 3 4 5 //EasingFunctionBase 为所有缓动函数提供基类 6 class CustomPowerEase : EasingFunctionBase 7 { 8 9 // Using a DependencyProperty as the backing store for Power.10 // This enables animation, styling, binding, etc...11 12 // UIPropertyMetadata(object Defa... 阅读全文
posted @ 2012-04-06 15:30 January 阅读(1012) 评论(0) 推荐(0) 编辑
摘要: 1 <Grid> 2 3 <Rectangle Stroke="Olive" Width="300" Height="300" > 4 5 <Rectangle.Fill> 6 <!--StattPoint,二维起始坐标,默认为(0,0)--> 7 <LinearGradientBrush StartPoint="0,0" EndPoint="0.012,0.012" SpreadMethod="Reflect"> 阅读全文
posted @ 2012-04-06 12:54 January 阅读(1481) 评论(0) 推荐(0) 编辑
摘要: 说明:本例简单展示了InkCanvas的使用,并详细列出了InkCanvasEditingMode的枚举值。 <Grid> <InkCanvas Name="inkCanvas" Background="Ivory"> <InkCanvas.DefaultDrawingAttributes> <Ink:DrawingAttributes xmlns:ink="system-windows-ink" Color="Red" Width="5" /> 阅读全文
posted @ 2012-04-06 10:57 January 阅读(1905) 评论(0) 推荐(0) 编辑
摘要: Thumb类,表示可由用户拖动的控件。其主要三个事件分别DragDelta,DragStarted,DragCompleted.DragDelta——当Thumb控件具有逻辑焦点和鼠标捕获时,随着鼠标位置更改发生一次或多次。DragStarted——在Thumb控件接收逻辑焦点和鼠标捕获时发生。DragCompleted——在Thumb控件失去鼠标捕获时发生。 1 <Window.Resources> 2 <ResourceDictionary> 3 <ControlTemplate x:Key="template1"> 4 <El 阅读全文
posted @ 2012-04-06 10:43 January 阅读(6287) 评论(0) 推荐(0) 编辑
摘要: 1 <Window x:Class="ClipToBounds.Window1" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 Title="ClipToBounds" Height="300" Width="300" 5 > 6 <!--ClipToB 阅读全文
posted @ 2012-04-06 10:09 January 阅读(2125) 评论(1) 推荐(1) 编辑
摘要: 案例实现效果:通过鼠标左键单击窗口空白处,按住鼠标来拖动窗口。该案例实现很简单,可以应用在一些自定义窗口(如窗口不显示标题栏等情况)。<Window x:Class="ClickWhitespaceAndDrag.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ClickWhitespaceAnd 阅读全文
posted @ 2012-04-05 17:40 January 阅读(269) 评论(0) 推荐(0) 编辑