【发布时间】:2014-05-21 09:37:36
【问题描述】:
我环顾四周寻找解决问题的方法,但我相信很多可用的解决方案都是针对该问题的。
基本上,我在 Datagrid 单元格中有一个进度条,它可以正常工作。但是,我现在想在 Progressbar 中放置文本以显示实际百分比。 这是怎么做到的?
到目前为止我的代码
<DataGridTemplateColumn Header="Percentage Downloaded" Width="5*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ProgressBar Value="{Binding Path=PercentageDownloaded, Mode=OneWay}" Minimum="0" Maximum="100" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
为了代表我的努力,我尝试在进度条中使用 tag 属性并使用都失败的文本块。
非常感谢
* 解决方案 *
GiangregorioC 提供的解决方案有效,因为我没有意识到您可以将标签放在 DataGridCellTemplate 中!
【问题讨论】:
标签: c# wpf datagrid progress-bar