Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WPF Form won't refresh

Posted on 2011-09-19
2
Medium Priority
?
328 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 2000 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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