Current Time Not working in WPF DLL
- by Anu
HI,
I making one DLL in WPF,C# and im using it in VC++.In that DLL, ihave one textblock to display current time,But when i run the WPF application as WIndows application it shows current time correctly and also updated with new timings.But when i use it as Dll in VC++ applcation,the current time is not get updating.It shows the time when the applcaiton is loaded.thats all.Its not get updated.
Code:
public Button()
{
InitializeComponent();
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
}
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
DataContext = DateTime.Now.ToString("g");
}
XAML:
<TextBlock Margin="0,6,211,0" Name="textBlock1" Text="{Binding}"/>