<ItemsControl Margin=""
ItemsSource="{Binding Source={StaticResource myTodoList}}">
<!--The ItemsControl has no default visual appearance.
Use the Template property to specify a ControlTemplate to define
the appearance of an ItemsControl. The ItemsPresenter uses the specified
ItemsPanelTemplate (see below) to layout the items. If an
ItemsPanelTemplate is not specified, the default is used. (For ItemsControl,
the default is an ItemsPanelTemplate that specifies a StackPanel.-->
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<Border BorderBrush="Aqua" BorderThickness="" CornerRadius="">
<ItemsPresenter/>
</Border>
</ControlTemplate>
</ItemsControl.Template>
<!--Use the ItemsPanel property to specify an ItemsPanelTemplate
that defines the panel that is used to hold the generated items.
In other words, use this property if you want to affect
how the items are laid out.-->
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<!--Use the ItemTemplate to set a DataTemplate to define
the visualization of the data objects. This DataTemplate
specifies that each data object appears with the Proriity
and TaskName on top of a silver ellipse.-->
<ItemsControl.ItemTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value=""/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataTemplate.Resources>
<Grid>
<Ellipse Fill="Silver"/>
<StackPanel>
<TextBlock Margin="3,3,3,0"
Text="{Binding Path=Priority}"/>
<TextBlock Margin="3,0,3,7"
Text="{Binding Path=TaskName}"/>
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<!--Use the ItemContainerStyle property to specify the appearance
of the element that contains the data. This ItemContainerStyle
gives each item container a margin and a width. There is also
a trigger that sets a tooltip that shows the description of
the data object when the mouse hovers over the item container.-->
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Control.Width" Value=""/>
<Setter Property="Control.Margin" Value=""/>
<Style.Triggers>
<Trigger Property="Control.IsMouseOver" Value="True">
<Setter Property="Control.ToolTip"
Value="{Binding RelativeSource={x:Static RelativeSource.Self},
Path=Content.Description}"/>
</Trigger>
</Style.Triggers>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>

ControlTemplate in WPF —— ItemsControl的更多相关文章

  1. WPF ItemsControl ListBox ListView比较

    在进行列表信息展示时,WPF中提供多种列表可供选择.这篇博客将对WPF ItemsControl, ListBox, ListView进行比较. 相同点: 1. 这三个控件都是列表型控件,可以进行列表 ...

  2. WPF ItemsControl 手动刷新

    原文:WPF ItemsControl 手动刷新 遇到这样一个问题, 我的ItemsSource是绑定到一个ObservableCollection<T>类型的实力上去的. 但是T类型没有 ...

  3. WPF ItemsControl 控件支持鼠标滚轮滑动

    此文章意在解决在WPF中ItemsControl类型的集合控件支持鼠标滚轮操作,并可控制滚动的速度. 第一步:给ItemsControl添加滚轮事件. this.listBox.AddHandler( ...

  4. ControlTemplate in WPF —— TreeView

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

  5. ControlTemplate in WPF —— Slider

    <!--Slider 样式--> <Style x:Key="StyleForRepeatButton" TargetType="{x:Type Rep ...

  6. ControlTemplate in WPF —— DataGrid

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

  7. ControlTemplate in WPF —— Calendar

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

  8. ControlTemplate in WPF ——ScrollBar

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

  9. ControlTemplate in WPF —— Menu

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

随机推荐

  1. Sql Server 常用日期格式

    SQL Server中文版的默认的日期字段datetime格式是yyyy-mm-dd Thh:mm:ss.mmm 例如: select getdate() 2004-09-12 11:06:08.17 ...

  2. CSS中cursor属性

    光标类型   CSS十字准心 cursor: crosshair;手 cursor: pointer;cursor: hand;写两个是为了照顾IE5,它只认hand.等待/沙漏 cursor: wa ...

  3. CI/CD----jenkins安装配置

    1.下载jenkins rpm包. https://pkg.jenkins.io/redhat/ 2.安装 rpm -ivh jenkins-2.182-1.1.noarch systemctl st ...

  4. 区块链——java实现

    简述 本文主要的内容试一次关于区块链的作业,本次作业中有很多地方和实际的区块链不符合,比如hash,本文实现的区块链只是用了区块本身的hash并没去区分,头部和数据部分.仅供参考学习. 介绍 内容有点 ...

  5. IDEA查看JDK源代码

    之前已经讲解过如何使用Eclipse查看源代码,IDEA作为一个集成开发环境越来越流行,今天学习以下如何使用Eclipse查看JDK的代码. File->Project Structure,选择 ...

  6. POJ3311Hie with the Pie(floyd传递+DP,状态压缩)

    问题 The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfo ...

  7. SIM800c收发短信及AT指令

    一.sim800设备安装 淘宝搜索sim800,差不多就是这么个样子 购买之后,安装手机卡,卡的缺口向外插入,会有卡住的感觉,再按一下卡会弹出 安装usb转串口驱动(CH340),设备的指示灯先是快闪 ...

  8. 【SQL-分组合并字符串】把相同分组的某个字段合并为同一个字符串(使用函数)

    场景:我要把同一个订单同一个客户同一个产品分组合并,同时把该产品所有的库位列举出来,合成一个字符串. 原始数据: 我要得到下面的结果: SQL如下: ==先建个方法== create function ...

  9. 自定义 Swiper 的pageControl

    .part5-bg .swiper2 .swiper-pagination2{ bottom: 0.4rem; } /*未选中的小圆点样式*/ .part5-bg .swiper2 .swiper-p ...

  10. C语言 - strcpy和strncpy的编程实现及总结

    一.字符串的strcpy与strncpy函数 1.编程实现strcpy函数(笔试很容易考到) 要求: 原型:char *stpcpy(char *strDest,char *strSrc); 头文件: ...