【问题标题】:How to remove blank space between column of listview wpf?如何删除listview wpf列之间的空格?
【发布时间】:2021-07-11 02:22:17
【问题描述】:

I want to remove blank between Symbol column and Price column 水平对齐不起作用

我的代码:

<GridViewColumn Width="80" Header="Symbol">
    <GridViewColumn.CellTemplate >
        <DataTemplate>
            <Grid Width="200" Background="Blue" Margin="0,0,0,0" Height="25" HorizontalAlignment="Stretch">
                <TextBlock Text="{Binding Symbol}" Width="auto" />
            </Grid>
        </DataTemplate>
    </GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Price" Width="90">
    <GridViewColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding LastClose, StringFormat={}{0:N2}}" />
        </DataTemplate>
    </GridViewColumn.CellTemplate>
</GridViewColumn>

【问题讨论】:

  • 从你的红色圆圈中不清楚你想删除什么空白(从标题中,还是从数据单元格中?)。显示一个红色矩形可能会更好。

标签: wpf xaml listview


【解决方案1】:

这并不理想,但是您是否尝试过设置负的右边距,例如“0,0,-10,0”或尝试调整 Grid 上的 Padding 属性。

附带说明,我不确定您是否在 TextBlock 中新增了 Width="auto"。

【讨论】:

  • 谢谢。我正在使用边距 =“-6,0”。这是工作
猜你喜欢
  • 2021-11-23
  • 2014-08-13
  • 1970-01-01
  • 2022-01-20
  • 2018-10-07
  • 1970-01-01
  • 2012-12-19
  • 1970-01-01
  • 2015-05-30
相关资源
最近更新 更多