Solved

WPF Form won't refresh

Posted on 2011-09-19
2
321 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
[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
2 Comments
 
LVL 86

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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