WPF ListView控件布局自定义示例

这篇博客介绍了如何在WPF环境中自定义ListView的布局,包括引用GrayscaleEffect模块实现灰度效果,并提供了多个参考资料链接,涉及ListBox的使用、数据绑定、拖放操作、选择颜色等WPF和Silverlight的相关知识。
摘要由CSDN通过智能技术生成

kagula 2012-04-12

概要

     以源码的形式贴出,免得忘记后,再到网上查资料。在VS2008+SP1环境下调试通过

     引用的GrayscaleEffect模块,可根据参考资料《Grayscale Effect...》中的位置下载。

正文

    如何布局是在App.xaml中定义源码如下

<Application x:Class="CWebsSynAssistant.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             
    xmlns:effect="clr-namespace:GrayscaleEffect;assembly=GrayscaleEffect"
    StartupUri="Window1.xaml">
    <Application.Resources>
        <!-- ListView的布局模板-->
        <ControlTemplate x:Key="myLVTemplate" TargetType="{x:Type ListView}">
            <Grid>
                <ScrollViewer x:Name="ScrollViewerElement" 
                       Background="White" 
                       VerticalScrollBarVisibility="Auto" 
                       HorizontalScrollBarVisibility="Disabled">
                    <ItemsPresenter>
                    </ItemsPresenter>
                </ScrollViewer>
            </Grid>
        </ControlTemplate>

        <!-- ListViewItem的布局模板-->
        <DataTemplate x:Key="myLVItemTemplate">
            <Grid Name="myGrid" Width="70" Margin="8,8,0,0">
                <Grid.RowDefinitions>
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kagula086

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值