zoukankan      html  css  js  c++  java
  • WPF备忘录(4)打个勾画个叉娱乐下

     <Path Grid.Column="2" Data="M43,5 L20,40 20,40 0,20 6,15 18,26 37,7 43,5 z" Fill="Green" Margin="5"  Stretch="Fill" HorizontalAlignment="Right"/>


     <Path  Margin="5" Data="M50,25 L25,50 M25,25 50,50" Fill="#FFF4F4F5" Stretch="Fill" Stroke="Red" StrokeThickness="8" HorizontalAlignment="Right"/>

     

    好了,看这个红叉叉打的,下面先来一条异常:

    1.在“System.Windows.Baml2006.DeferredBinaryDeserializerExtension”上提供值时引发了异常

    上图:

    这个问题我纠结了半天查了好多资料而不可得,总以为是数据绑定之类的错误,最后才发现是一个TextBlock的背景颜色值设错了。

    血淋淋的教训啊浪费了半天时间就因为自己的大意。遇到这种问题如果实在找不错问题,就一个一个剔除控件,找到出问题的控件

    2.一个自定义ListView模板,看你是否用的上

    <Grid>
            <ListView  Name="LV_Test" SelectionMode="Multiple" Background="{x:Null}">
                <ListView.Template>
                    <ControlTemplate>
                        <Border CornerRadius="10" BorderBrush="RoyalBlue" BorderThickness="5">
                            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" >
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </ListView.Template>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel IsItemsHost="True"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListViewItem}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListViewItem}">
                                    <Border Name="BD_Collector" CornerRadius="5" Background="DarkSeaGreen" Width="auto" Height="30" Margin="5">
                                        <StackPanel Orientation="Horizontal">
                                        <Label Content="{Binding XH}" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="13" />
                                            <Label Content="{Binding time}" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="13" />
                                        </StackPanel>
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter TargetName="BD_Collector" Property="Background" Value="YellowGreen" />
                                        </Trigger>
                                        <Trigger Property="IsSelected" Value="True">
                                            <Setter TargetName="BD_Collector" Property="Background" Value="DarkGreen" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListView.ItemContainerStyle>
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="序号"   DisplayMemberBinding="{Binding XH}" Width="100"/>
                        <GridViewColumn Header="日期" DisplayMemberBinding="{Binding time}" Width="140"/>
                        <GridViewColumn Header="项目" DisplayMemberBinding="{Binding CostItem}" Width="100"/>
                        <GridViewColumn Header="金额" DisplayMemberBinding="{Binding CostMoney}" Width="100"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </Grid>

    上图:

    未完待续……

  • 相关阅读:
    SQL SERVER 2005生成带数据的脚本文件 [work around]
    VB.NET窗体关闭事件
    Code::Blocks The open source, cross platform, free C++ IDE.
    VB Twips And Pixels 缇和像素
    JQuery 鼠标点击其它地方隐藏层
    Asp.net 基于Form的权限方法备忘
    JQuery Highcharts图表控件多样式显示多组数据
    ASP.NET中动态获取数据使用Highcharts图表控件
    使用windows服务和.NET FileSystemWatcher对象来监控磁盘文件目录的改变
    【JQuery插件】Select选择框的华丽变身
  • 原文地址:https://www.cnblogs.com/smiler/p/3242946.html
Copyright © 2011-2022 走看看