Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to reduce the datagrid cell weight in wpf

$
0
0

Hi,

    I want to reduce the Datagrid Cell weight , i dont know how to do it please help me.....

XXAML Code.......

<DataGrid x:Name="gvaccounts" Grid.Column="0" Grid.Row="1" x:Uid="MyDataGrid" AutoGenerateColumns="False" AlternationCount="1" SelectionMode="Single" ItemsSource="{Binding Path=Table}" SelectionUnit="FullRow" IsReadOnly="True" HeadersVisibility="Column" FontFamily="Arial" FontSize="13" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BorderBrush="#FF04041A" Margin="5,5,5,5" >
                        <DataGrid.CellStyle>
                            <Style TargetType="DataGridCell">
                                <Setter Property="BorderThickness" Value="0.5" />
                                <Setter Property="BorderBrush" Value="AliceBlue" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type DataGridCell}">
                                           <Grid Background="{TemplateBinding Background}">
                                               <ContentPresenter VerticalAlignment="Center" />
                                           </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </DataGrid.CellStyle>
                        <DataGrid.RowStyle>
                            <Style TargetType="controls:DataGridRow">
                                <Setter Property="Height" Value="25" />
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="AliceBlue" />
                                        <Setter Property="Foreground" Value="Black" />
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="AliceBlue" />
                                        <Setter Property="Foreground" Value="Black" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </DataGrid.RowStyle>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=aid}" IsReadOnly="True" Header="#ID" Width="0.6*" />
                            <DataGridTextColumn Binding="{Binding Path=Date,StringFormat=dd-MMM-yyyy}" Header="Date" Width="1*" IsReadOnly="True" />
                            <DataGridTextColumn Binding="{Binding Path=Spentby}" Header="Spent By" Width="2*" IsReadOnly="True" />
                            
                        </DataGrid.Columns>
                    </DataGrid>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>