Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am not able show the current time for the winform dattimepicker control in WPF.It shows default time.

If use the dame peiece of code in winform load it will show the current time.I dont understand what went wrong

can you please let me know what was wrong with it.

xaml:
HTML
<Grid Grid.Row="6" Name="gdCheckIn"  Height="20" HorizontalAlignment="Left"  VerticalAlignment="Center" Width="200" Margin="140,0,0,0">
                                                   <WindowsFormsHost>
                                                       <wf:DateTimePicker x:Name="dtprom" ValueChanged="dtprom_SelectedDateChanged"/>
                                               </WindowsFormsHost>
                                               </Grid>


code on windows load:

C#
dtprom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
            dtprom.CustomFormat = "dd-MM-yyyy hh:mm";


I don't get any error or exception but i xaml where ever added the above xaml code,at that control if i hover on it,shows "cannot register duplicate name "dtprom" in this scope".

If i execute the same code in a new project it shows with todays Date and Current time.How can i solve it.Any idea.
Posted
Updated 28-Aug-13 23:39pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900