KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a WPF Datagrid in which one of the columns is a Date Column. So i have used a DataTemplateColumn as Follows <my:DataGridTemplateColumn CellTemplate="{StaticResource EffDateDateTimePickerControl}" CellEditingTemplate="{StaticResource addrEffDate}" Header="Effective Date"/> And in my Resource File i have written the following code: <Style TargetType="{x:Type my:Calendar}" x:Key="CalenderControlTemplate"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="my:Calendar" > <my:CalendarItem Name="myCalendarItem" Background="White" BorderBrush="Black" BorderThickness="1" VerticalAlignment="Center" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <DataTemplate x:Key="EffDateDateTimePickerControl"> <Label x:Name="lblEffDate" Content="{Binding effectiveDate,Mode=TwoWay}" ></Label> </DataTemplate> <DataTemplate x:Key="addrEffDate"> <my:DatePicker x:Name="dpEffDate" Text="{Binding Path=effectiveDate,Mode=TwoWay}" SelectedDate="{Binding Now}" DisplayDateStart="{Binding Now}" CalendarStyle="{DynamicResource CalenderControlTemplate}" /> </DataTemplate> The problem is when i click on the DatePicker control the default date is set to 1/1/0001? How can i set my datepicker to set to the current Date.
Tags (comma-separated)
Save Edits
Cancel