Solved

WPF Form won't refresh

Posted on 2011-09-19
2
316 Views
Last Modified: 2012-05-12
Hello,

I have a sample WPF project which represents an issue that I am having.  

The main WPF window has a textbox that I have bound to a custom DependencyObject's (the TextboxText class inherits from DependencyObject) DependencyProperty named TextIt.  I have a command button that when clicked calls the TextIt's class' PrintIt() Method.  The PrintIt method has a for loop where the TextIt property is being updated and then put to sleep for a few milliseconds.  

My intent is to see the value, that the dependency property is changed to, in the WPF window each time the dependency property is updated from the PrintIt method.  Did I miss something? WpfTest.zip
0
Comment
Question by:modotx
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 36562236
Try placing the DoEvents() method here:
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcherframe.aspx

...into your loop:

        For i = 0 To 100
            TextIt = "Test" & i.ToString
            System.Threading.Thread.Sleep(500)
            DoEvents()
        Next
0
 

Author Comment

by:modotx
ID: 36563101
I wound up using the code supplied in the link since I wasn't wanting to have to include the VB.Net assembly as a reference.  Ty so much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

943 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now