我想摆脱数据网格左侧的行调整器,我似乎无法做到。
我正在使用 WPF xaml
<DataGrid x:Name="ProcessDatagrid" Height="130" GridLinesVisibility="None" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="10,10,10,10" SelectionMode="Single" SelectionUnit="FullRow" AlternatingRowBackground="#FFEEEE" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" IsReadOnly="True"
SelectedCellsChanged="ProcessDatagrid_SelectedCellsChanged" CanUserResizeColumns="False" AutoGenerateColumns="False" RowDetailsVisibilityMode="Collapsed">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Padding" Value="0" />
<Setter Property="ToolTip">
<Setter.Value>
<TextBlock Text="{Binding Path=FullName, Mode=OneWay}" />
</Setter.Value>
</Setter>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0" />
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name, Mode=OneWay}" Width="*"/>
<DataGridTextColumn Header="ID" Binding="{Binding Path=Pid, Mode=OneWay}" Width="50"/>
</DataGrid.Columns>
</DataGrid>
答案 0 :(得分:0)
您设置了CanUserResizeColumns,但在DataGrid中尝试了CanUserResizeRows =“False”
答案 1 :(得分:0)
DataGrid.RowHeaderWidth
可以做到这一点:
<DataGrid
RowHeaderWidth="0"
...
或使用DataGrid.RowHeaderStyle
折叠它们:
<DataGrid
...
>
<DataGrid.RowHeaderStyle>
<Style TargetType="DataGridRowHeader">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</DataGrid.RowHeaderStyle>
答案 2 :(得分:0)
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding ElementName=ColX,Path=ActualWidth}"/>
<ColumnDefinition Width="{Binding ElementName=ColY, Path=ActualWidth}"/>
</Grid.ColumnDefinitions>
<DataGrid Style="{x:Null}" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding Points}" SelectedItem="{Binding SelectedRow}" SelectedIndex="-1" IsSynchronizedWithCurrentItem="True" CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Extended" AutoGenerateColumns="False" HorizontalScrollBarVisibility="Disabled"> <DataGrid.Columns>
<DataGridTextColumn x:Name="ColX" Header="X (nm)" Binding="{Binding X, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Width="Auto" MinWidth="100" />
<DataGridTextColumn x:Name="ColY" Header="Y (nm)" Binding="{Binding Y, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Width="Auto" MinWidth="100" />
</DataGrid.Columns>
答案 3 :(得分:0)
最简单的方法是设置iphone 4.4,4.7,3.5 inches
的{{1}}属性。在你的情况下:
HeadersVisibility