Click here to Skip to main content
Licence CPOL
First Posted 26 Jan 2008
Views 32,478
Downloads 248
Bookmarked 37 times

WPF ProcessingContentControl

By | 5 Feb 2008 | Article
A ContentControl that displays continuously progressing view when its content is being processed.
ProcessingContentControl_demo

Introduction

Sometimes you want to provide feedback to the user while the data displayed inside a certain control is loaded / processed, updated, etc. An obvious example is media player. ProcessingContentControl lets you achieve this goal.

Using the Code

Host any element inside ProcessingContentControl. Set IsContentProcessing property to toggle processing mode. When the property is set to true, an overlay layer will appear, blocking interaction with the hosted element. The overlay layer displays animated progress view, as shown in the picture above.

Usage Example

<process:ProcessingContentControl IsContentProcessing="True" >
    <... your content here>
</process:ProcessingContentControl> 

History

  • 5th February, 2008: Bug fixes
  • 26th January, 2008: Initial release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Yaakov Davis

Software Developer

Israel Israel

Member

Experienced in .Net, C#, WPF, user experience.
 
Read my blog: http://uxoriented.blogspot.com/

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCouple of issues PinmemberAndrew Wood10:31 4 Feb '08  
Hi,
 
Firstly, I really want to use this control in an application, that it is a very concise example impressed me.
 
Came across a couple of issues that are raised though:
 
1) If you have two ProcessingContentControls, and the IsContentProcessing property is set at different times (eg. you enable a second one when the first is half way through a loop), you get this strange overlay effect (like both controls are overlaid on each instance). This indicated that something was being shared somewhere, took a while to find it though. Turns out it's the brush in the resource dictionary, and the issue met is the one described here[^]. An alternative is to sync up the animations, but it seems nice to have them able to be independent but sharing resources.
 
Solution is to have a different brush for each of the dot elements, not sure of the best way though (quick fix is to create a new brush in the timer callback, but not ideal).
 
2) The other problem I found is that with the current implementation I could not add named controls as content (using x:Name), the cause is that this control already has a name defined in xaml (the PART_ name on the contentpresenter). The workaround for this is to make sure that this control is only defined in code-behind, not in xaml (as described here[^]). Fortunately in this situation it's easy, just remove the ProcessContentControl xaml file and the partial header from the code-behind.
 
Hope that all makes sense, and once again thank you for your work on this implementation, I look forward to any updates you make.
 
Andrew.
GeneralRe: Couple of issues PinmemberYaakov Davis7:11 5 Feb '08  
GeneralRe: Couple of issues PinmemberAndrew Wood11:34 5 Feb '08  
QuestionNice article! [modified] PinmemberAndrew Wood11:27 28 Jan '08  
GeneralRe: Nice article! Pinmemberyaakov`1:27 29 Jan '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 5 Feb 2008
Article Copyright 2008 by Yaakov Davis
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid