Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

WPF: A Most Useful Threading Component

, 30 Dec 2009
A threading component that shows failures/busy status and data.
<Window x:Class="ThreadingComponent.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ThreadingComponent"
    WindowStartupLocation="CenterScreen"
    Title="ThreadingComponent" Height="400" Width="730">
    <DockPanel LastChildFill="True">
        <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
            <Button Content="Run Log Running Operation" Command="{Binding RunCommand}" Margin="10" ToolTip="Do the long running operation in a new thread"/>
            <Button Content="Simulate Failure" Command="{Binding ShouldFailCommand}" Margin="10" ToolTip="SIMULATE a failure that occurs during the long running threading operation"/>
            <Button Content="Click Me After You Run Log Running Operation (To See UI Is Still Responsive)" Margin="10" Click="Button_Click" ToolTip="Simply shows a MessageBox to show that UI is not blocked while long running threadin operation is happening"/>
        </StackPanel>
        
        <local:ThreadableHostControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
            ThreadableItem="{Binding ThreadVM}">

            <ListView Background="WhiteSmoke" BorderBrush="Black" BorderThickness="5"
                      ItemsSource="{Binding ThreadVM.Data.DataObject}"
                      >
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Text" Width="500" 
                                        DisplayMemberBinding="{Binding Path=Text}"/>
                        <GridViewColumn Header="Age" Width="100" 
                                        DisplayMemberBinding="{Binding Path=Age}"/>
                    </GridView>
                </ListView.View>
            </ListView>
            
        </local:ThreadableHostControl>
        
    </DockPanel>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Sacha Barber
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
 
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
 
Both of these at Sussex University UK.
 
Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 30 Dec 2009
Article Copyright 2009 by Sacha Barber
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid