我有一个绑定到可观察集合的 DevXPress GridControl。我想格式化“WorkedHours”,但不知何故无法正常工作,所以结果看起来很难看。这是代码:
<dxg:GridControl ItemsSource="{Binding Result}">
<dxg:GridControl.TotalSummary>
<dxg:GridSummaryItem SummaryType="Sum" FieldName="Worked" DisplayFormat="0.0"/>
</dxg:GridControl.TotalSummary>
<dxg:GridControl.Columns>
<dxg:GridColumn Header="Month" DisplayMemberBinding="{Binding Path=Month}" Visible="{Binding Path=GroupByMonth}" Width="80"/>
<dxg:GridColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}" Visible="{Binding Path=ShowName}" Width="220"/>
<dxg:GridColumn Header="Project code" DisplayMemberBinding="{Binding Path=ProjectCode}" Visible="{Binding Path=ShowProjects}" Width="80" />
<dxg:GridColumn Header="Project description" DisplayMemberBinding="{Binding Path=ProjectDescription}" Visible="{Binding Path=ShowProjects}" Width="270"/>
<dxg:GridColumn Header="Wbs code" DisplayMemberBinding="{Binding Path=WbsCode}" Visible="{Binding Path=ShowWbs}" Width="80" />
<dxg:GridColumn Header="Wbs description" DisplayMemberBinding="{Binding Path=WbsDescription}" Visible="{Binding Path=ShowWbs}" Width="270" />
<dxg:GridColumn Header="Comment" DisplayMemberBinding="{Binding Path=Comment}" Visible="{Binding Path=ShowComment}" Width="270" />
<dxg:GridColumn Header="Worked hours" DisplayMemberBinding="{Binding Path=Worked,StringFormat=\{0\:N0\}}" Width="100" FieldName="Worked" />
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AllowGrouping="True" ShowAutoFilterRow="True" ShowTotalSummary="True"/>
</dxg:GridControl.View>
</dxg:GridControl>
关于如何解决它的任何想法?非常感谢。我尝试了不同的格式化选项,但它们都没有像预期的那样工作。