Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to bind WPF control to datetime.now()

Posted on 2010-09-19
1
Medium Priority
?
927 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 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 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