WPF DataGridTextColum 显示时间格式化

<DataGrid Name="DGVisit" Grid.Row="2" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" >
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="" Binding="{Binding Id}" MinWidth="110"/>
                            <DataGridTextColumn Header="房间号" Binding="{Binding VisitRoomNum}" MinWidth="250"/>
                            <DataGridTextColumn Header="房间类型" Binding="{Binding VisitRoom}" MinWidth="300"/>
                            <DataGridTextColumn Header="访问人员" Binding="{Binding VisitorName}" MinWidth="400"/>
                            <DataGridTextColumn Header="进入房间时间" Binding="{Binding Path=CreateTime,StringFormat='yyyy年MM月dd日 HH:mm:ss'}" MinWidth="300" />
                            <DataGridTextColumn Header="离开房间时间" MinWidth="300"/>
                        </DataGrid.Columns>
                    </DataGrid>

转载:https://www.cnblogs.com/dotnetHui/p/8464834.html

猜你喜欢

转载自blog.csdn.net/weixin_42193688/article/details/118961331