Solved

How to bind WPF control to datetime.now()

Posted on 2010-09-19
1
924 Views
Last Modified: 2012-05-10

Hi,

Just wondering how I would go about binding a WPF control to time.now.seconds (for example) so that it updates when the seconds property changes. I have it binding on initialization, but it does not update the UI as the property changes:


Dim MySourceProperty As New Binding("Second")
        MySourceProperty.Source = DateTime.Now
        MySourceProperty.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
        MySourceProperty.Mode = BindingMode.OneWay
        TextBlock1.SetBinding(TextBlock1.TextProperty, MySourceProperty)

Open in new window

0
Comment
Question by:satellite428
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 33710886
wont work.. if you need you txt block to get updated, u will need a timer and then call the binding refresh every second.. or create  custom property which returns DateTime.Now.Seconds and then call the property change of the property in a timer.

I dont think we can do this without a timer.(Using the story board is an option but that will be an over kill)
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question