Telerik RadGridView won't display Dates

南楼画角 提交于 2019-12-11 06:25:53

问题


I'm trying to display my Date in a RadGridView in ShortDate Format.

The code I used to generate the column is this :

<telerik:RadGridView x:Name="GenInq" Height="Auto" Width="Auto" 
  HorizontalAlignment="Left" Margin="0,-14,0,14" AutoGenerateColumns="False">
    <telerik:RadGridView.Columns>  
        <telerik:GridViewColumn Header="Date" 
          Binding.XmlNamespaceManager="{Binding Path=Date, StringFormat='{}{0:dd.MM.yyyy}'}"/>
    </telerik:RadGridView.Columns>   
</telerik:RadGridView>`  

This is my query i used to populate the DataGrid:

var query = from loan in Loans  
            select new {Date = loan.StatusCommittedDate}  

DataGrid.ItemsSource = query.ToList();

The issue I'm having is that the Date Entries are appearing BLANK in the datagrid, it populates the grid with blank entries.


回答1:


I was able to replicate the issue and got the same results you did.

You need to change the column definition accordingly:

<telerik:GridViewDataColumn Header="Date"
    DataMemberBinding="{Binding Path=Date, StringFormat='{}{0:dd.MM.yyyy}'}"/>


来源:https://stackoverflow.com/questions/21023836/telerik-radgridview-wont-display-dates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!