Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to bind WPF control to datetime.now()

Posted on 2010-09-19
1
Medium Priority
?
928 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
1 Comment
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 2000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

886 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