• DataGrid添加进度条列


    DataGridColumn类型的继承树 DataGridColumn的派生类: 一般情况下DataGridBoundColumn和DataGridComboBoxColumn足以满足多数列的样式,如果需要自定义列样式,则可以使用DataGridTemplateColumn类型

     <DataGrid  x:Name="mygrid" VerticalAlignment="Top"  AutoGenerateColumns="False" Foreground="White" Background="Transparent" Margin="0,20,0,0"
            RowBackground="Transparent" GridLinesVisibility="All"  HorizontalGridLinesBrush="Transparent" VerticalGridLinesBrush="Transparent"  BorderBrush="Transparent"
            VerticalContentAlignment="Center" HorizontalContentAlignment="Center"   FontSize="14.5"  RowHeaderWidth="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
             EnableColumnVirtualization="True" EnableRowVirtualization="True" ItemsSource="{Binding UnitHost}" ColumnHeaderStyle="{StaticResource ParkColumnHeader}">
            <DataGrid.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Yellow"/>
            </DataGrid.Resources>
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Setter Property="Height" Value="40"></Setter>
                </Style>
             </DataGrid.RowStyle>
             <DataGrid.Columns>
                 <DataGridTextColumn Header="停车场名称" Width="200"  Binding="{Binding name}" ElementStyle="{StaticResource ResourceKey=DataGridTextColumnCenterSytle}"/>
                 <DataGridTextColumn Header="已使用" Width="110"  Binding="{Binding used}" ElementStyle="{StaticResource ResourceKey=DataGridTextColumnCenterSytle}"/>
                 <DataGridTextColumn Header="未使用" Width="110"  Binding="{Binding notused}" ElementStyle="{StaticResource ResourceKey=DataGridTextColumnCenterSytle}"/>
                 <DataGridTemplateColumn  Header="使用占比" Width="200" >
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
                             <ProgressBar Value="{Binding ratio}" Background="#4C717171" BorderBrush="Transparent" Height="20"/>
                         </DataTemplate>
                      </DataGridTemplateColumn.CellTemplate>
                  </DataGridTemplateColumn>
                  <DataGridTextColumn Header=" " Width="80" Binding="{Binding ratioValue}" Foreground="#ec6941"  ElementStyle="{StaticResource ResourceKey=DataGridTextColumnCenterSytle}"/>
             </DataGrid.Columns>
    </DataGrid>
    

      

  • 相关阅读:
    sql语句 之聚合函数
    UML类图几种关系的总结
    关于Object.defineProperty的get和set
    devDependencies和dependencies的区别
    函数声明和函数表达式的区别
    移动端滑屏滚动事件的问题(横向滑动阻止垂直页面滚动)
    使用Cordova和JQM在ios上需要注意的问题
    阻止事件冒泡,阻止默认事件,event.stopPropagation()和event.preventDefault(),return fal的区别
    有关闭包的总结
    CSS命名规范——BEM思想(非常赞的规范)
  • 原文地址:https://www.cnblogs.com/zqyw/p/10875923.html
Copyright © 2020-2023  润新知