Hi,
I have am using autogenerated columns in a gridview, and I don't want to manually generate them.
What is the most painless way to get the column, when editing or inserting a date, to put the datepicker into DateSelectionMode=Month, and display the date as month/year.
I am already hooking the AutoGenerateColumns event to add aggregate functions on some columns, so I can add more here if necessary.
current grid style:
Thanks for your help,
Stew
I have am using autogenerated columns in a gridview, and I don't want to manually generate them.
What is the most painless way to get the column, when editing or inserting a date, to put the datepicker into DateSelectionMode=Month, and display the date as month/year.
I am already hooking the AutoGenerateColumns event to add aggregate functions on some columns, so I can add more here if necessary.
current grid style:
<Style TargetType="telerik:RadGridView" x:Name="Grid"> <Setter Property="ShowGroupPanel" Value="False" /> <Setter Property="CanUserInsertRows" Value="True" /> <Setter Property="ShowColumnFooters" Value="True" /> <Setter Property="ShowInsertRow" Value="True" /> <Setter Property="CanUserDeleteRows" Value="True" /> <Setter Property="SelectionMode" Value="Single" /> <Setter Property="RowIndicatorVisibility" Value="Collapsed" /> <Setter Property="AutoGenerateColumns" Value="True"/>Grid definition:<Setter Property="telerik:RadDateTimePicker.DateSelectionMode" Value="Month"/> <!--this doesn't seem to have any effect--> </Style>
<telerik:RadGridView Grid.Row="1" ItemsSource="{Binding Items}" Style ="{StaticResource Grid}" AutoGeneratingColumn="RadGridViewAutoGeneratingColumn" > </telerik:RadGridView>Item definition:
public class Item : NotificationObject { private DateTime _date = new DateTime(DateTime.Now.Year, DateTime.Now.Month,1); //default to this month [Display(Name = "Recovery Date")] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/yyyy}")] public DateTime Date { get { return _date; } set { if (_date != value) { _date = value; RaisePropertyChanged(() => Date); } } } }
Thanks for your help,
Stew