对于数字类型,WPF里的DataGrid不像AX那样可以自动格式化,需要写代码自己处理,AX这样的小众平台都能做到,WPF为啥要每个程序员自己折腾,可能是要考虑每个人的喜好吧。
<DataGridTextColumn Binding="{Binding Path=OrderQty,Mode=TwoWay,UpdateSourceTrigger=LostFocus,StringFormat='n2'}" 
                                    Header
="叫货数量">
                    <DataGridTextColumn.CellStyle>
                        <Style>
                            <Setter Property="FrameworkElement.HorizontalAlignment" Value="Right"/>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>

 

主要是Bingding里的StringFormat和Setter。

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2021-10-16
  • 2021-10-21
  • 2021-10-22
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2021-08-16
  • 2021-06-17
  • 2022-12-23
  • 2021-09-13
  • 2022-01-20
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案