嘿我想让我最右边的专栏固定在网格的右侧。 我不介意最后一列是否设置为固定宽度,因为它包含的图像是设置宽度。
这是“删除按钮”列,它是我网格中的最后一列。 这是它的样子: http://postimg.org/image/lmj2uo6nt/
<DataGridTemplateColumn Header="Remove" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Background="Transparent" BorderBrush="Transparent" Command="Delete">
<Image Source="{Binding fileDeleteImageLocation}" />
<Button.Template>
<ControlTemplate TargetType="Button">
<ContentPresenter Content="{TemplateBinding Content}"/>
</ControlTemplate>
</Button.Template>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
答案 0 :(得分:1)
将您的一个列宽设置为*,这将为该列分配剩余空间。这将把你的最后一栏放在最右边。