Problem with WPat

I created this datagrid and everything works fine, but there is this little nasty problem.

here is a screenshot of my datagrid

http://users.telenet.be/i_dislike_mushrooms/datagridproblem.JPG

But this little “column” on the left that annoys me like hell. Here is my code:

<Window x:Class="IMDB.ML.Window1"
Name="This"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="IMDB.ML" Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}"
Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
WindowStartupLocation="CenterScreen" WindowStyle="None">
<Window.Resources>
    <Style x:Key="HeaderTextStyle" TargetType="{x:Type dg:DataGridColumnHeader}">
        <Setter Property="Background" Value="DarkSlateGray" />
        <Setter Property="Foreground" Value="White" />
    </Style>
</Window.Resources>
<Grid>
    <Menu Height="22" Name="TopMenu" FontFamily="Verdana" FontSize="12" VerticalAlignment="Top" Background="DarkSlateGray">
        <Menu.BitmapEffect>
            <DropShadowBitmapEffect />
        </Menu.BitmapEffect>
        <MenuItem Header="_File" Background="Transparent" Foreground="White">
            <MenuItem Header="_Close" Background="DarkSlateGray" Foreground="White" Click="close_Click" />
        </MenuItem>
        <MenuItem Header="_Edit" Background="Transparent" Foreground="White">
        </MenuItem>
    </Menu>
    <dg:DataGrid Background="DarkSlateGray" ItemsSource="{Binding ElementName=This, Path=GameData}" ColumnWidth="*"
          Margin="5,35,5,5" AutoGenerateColumns="False" ColumnHeaderStyle="{StaticResource HeaderTextStyle}">
        <dg:DataGrid.Columns>
            <dg:DataGridTextColumn IsReadOnly="True" Binding="{Binding Title}" Header="Title" />
            <dg:DataGridTextColumn IsReadOnly="True" Width="60"  Binding="{Binding Score}" Header="Score" />
            <dg:DataGridTextColumn IsReadOnly="True" Width="60" Binding="{Binding Year}" Header="Year" />
            <dg:DataGridTextColumn IsReadOnly="True" Binding="{Binding Genre}" Header="Genre" />
            <dg:DataGridHyperlinkColumn IsReadOnly="True" Width="200" Binding="{Binding Link}" Header="Link" />
            <dg:DataGridCheckBoxColumn Width="50" Binding="{Binding Seen}" Header="Seen" />
        </dg:DataGrid.Columns>
    </dg:DataGrid>
</Grid>

Does anyone know how I can stop this? Because it is ugly :)

+3
source share
1 answer

WtFudgE,

, , . "", , , . . , , RowHeaderWidth="0" . :

<Window x:Class="IMDB.ML.Window1"
Name="This"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="IMDB.ML" Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}"
Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
WindowStartupLocation="CenterScreen" WindowStyle="None">
<Window.Resources>
    <Style x:Key="HeaderTextStyle" TargetType="{x:Type dg:DataGridColumnHeader}">
        <Setter Property="Background" Value="DarkSlateGray" />
        <Setter Property="Foreground" Value="White" />
    </Style>
</Window.Resources>
<Grid>
    <Menu Height="22" Name="TopMenu" FontFamily="Verdana" FontSize="12" VerticalAlignment="Top" Background="DarkSlateGray">
        <Menu.BitmapEffect>
            <DropShadowBitmapEffect />
        </Menu.BitmapEffect>
        <MenuItem Header="_File" Background="Transparent" Foreground="White">
            <MenuItem Header="_Close" Background="DarkSlateGray" Foreground="White" Click="close_Click" />
        </MenuItem>
        <MenuItem Header="_Edit" Background="Transparent" Foreground="White">
        </MenuItem>
    </Menu>
    <dg:DataGrid Background="DarkSlateGray" ItemsSource="{Binding ElementName=This, Path=GameData}" ColumnWidth="*"
          Margin="5,35,5,5" AutoGenerateColumns="False" RowHeaderWidth="0" ColumnHeaderStyle="{StaticResource HeaderTextStyle}">
        <dg:DataGrid.Columns>
            <dg:DataGridTextColumn IsReadOnly="True" Binding="{Binding Title}" Header="Title" />
            <dg:DataGridTextColumn IsReadOnly="True" Width="60"  Binding="{Binding Score}" Header="Score" />
            <dg:DataGridTextColumn IsReadOnly="True" Width="60" Binding="{Binding Year}" Header="Year" />
            <dg:DataGridTextColumn IsReadOnly="True" Binding="{Binding Genre}" Header="Genre" />
            <dg:DataGridHyperlinkColumn IsReadOnly="True" Width="200" Binding="{Binding Link}" Header="Link" />
            <dg:DataGridCheckBoxColumn Width="50" Binding="{Binding Seen}" Header="Seen" />
        </dg:DataGrid.Columns>
    </dg:DataGrid>
</Grid>

, (obviosly , - Person .):

http://img34.imageshack.us/img34/5637/demodatagrid.jpg

, ,

!

+2

Source: https://habr.com/ru/post/1723461/


All Articles