I would like this field to be blank.
Thanks in advance
Chris
9 Answers, 1 is accepted
The sample project attached demonstrates how to achieve this using a custom value converter.
In the binding of the column we specify our converter. Then in the Convert method we check if the date is "null ". There is the place where you can do your custom formatting as well as I am not sure the column format string will still work with this approach.
Best wishes,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I downloaded the sample ZIPped project and I see it working as desired. My problem is that my data is coming from a list of loaded objects that contain a number of properties (and my grid has a number of columns, each displaying a property). I can't figure out the syntax to use in either the .XAML or the .XAML.VB file in my project to associate the DateConverter with the date column. Here's a snippet of my current .XAML:
...
<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding origin}" Header="" />
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding title}" Header="Title" TextWrapping="Wrap" />
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding dueDate}" Header="Due Date" DataFormatString="{}{0:dd/MM/yyyy}" TextWrapping="Wrap" />
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding delivery}" Header="Delivery" TextWrapping="Wrap"/>
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding duration}" Header="Duration" TextWrapping="Wrap"/>
...
When I look in the sample project, I see:
...
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Converter={StaticResource MyDateConverter}}" HeaderText="Date" />
</telerik:RadGridView.Columns>
...
My challenge: what is the syntax that allows my to associate the DateConverter class, as above, with my date column that is bound to the dueDate property, keeping the dueDate property associated with the column, as well.
thanks in advance!
Here is an example:
<telerik:GridViewDataColumn DataMemberBinding="{Binding dueDate, Converter={StaticResource MyDateConverter}}" />
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:MinFunction ResultFormatString="{}First: {0:d}" SourceField="Date" />
<telerik:MaxFunction ResultFormatString="{}Last: {0:d}" SourceField="Date" />
</telerik:GridViewDataColumn.AggregateFunctions>
You can apply converter to the Binding in your custom footer/group footer. Please check this demo for more info how to define custom footers.
All the best,Vlad
the Telerik team
<
Grid.Resources
>
<
local:MyConverter
x:Key
=
"myDataConverter"
/>
</
Grid.Resources
>
<
telerik:GridViewDataColumn
Header
=
"Discontinued"
DataMemberBinding
=
"{Binding Discontinued}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Discontinued, Converter={StaticResource myConverter}}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>