Click here to Skip to main content
15,898,986 members
Home / Discussions / WPF
   

WPF

 
General[Message Deleted] Pin
fjparisIII2-Jun-09 4:40
fjparisIII2-Jun-09 4:40 
General[Message Deleted] Pin
fjparisIII2-Jun-09 5:33
fjparisIII2-Jun-09 5:33 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
fjparisIII2-Jun-09 6:24
fjparisIII2-Jun-09 6:24 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:36
Mark Salsbery2-Jun-09 6:36 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
fjparisIII2-Jun-09 7:00
fjparisIII2-Jun-09 7:00 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:43
Mark Salsbery2-Jun-09 6:43 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:45
Mark Salsbery2-Jun-09 6:45 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:29
Mark Salsbery2-Jun-09 6:29 
fjparisIII wrote:
I just hope you don't run out of patience with me


Heh no problem - it's all a learning experience Smile | :)

fjparisIII wrote:
how to do basic things like extending the namespace of XAML


Same as you did for the "cm" namespace in your sample above. For example
the code I posted was in the WPFTester namespace, so I use something like this:
xmlns:local="clr-namespace:WPFTester"

Note I didn't need to specify an assembly, because its in the same assembly as the XAML.


Anyway, I was under the impression from your previous posts that you were
already using a BackgroundWorker, and if so, you should have known what
RunWorkerAsync() does (your background thread wouldn't run without calling
it) and how to add a DoWork event handler, which is the code that runs on the
background thread.

I don't know how you do it from XAML - I use code, and it looks something like this:
    <code>// Note you can use BackgroundWorker or WPFSTABackgroundWorker - they both work the same</code>

    WPFSTABackgroundWorker bw = new WPFSTABackgroundWorker();
    bw.WorkerReportsProgress = true;
    bw.DoWork += new DoWorkEventHandler(bw_DoWork);
    bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
    bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
    bw.RunWorkerAsync();

...

        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            <code>// Called on background thread - CANNOT access UI objects directly here!</code>

            WPFSTABackgroundWorker bw = sender as WPFSTABackgroundWorker;

            for (int i = 0; i < 10; i++)
            {
                bw.ReportProgress(i * 10);
                Thread.Sleep(500);
            }
        }

        void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            <code>// Called on UI thread - CAN access UI objects directly here!</code>

            progrssBar.Value = e.ProgressPercentage;
        }

        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            <code>// Called on UI thread - CAN access UI objects directly here!</code>

            MyScaleButton.Content = "Thread completed!";
        }


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

General[Message Deleted] Pin
fjparisIII2-Jun-09 7:52
fjparisIII2-Jun-09 7:52 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 8:07
Mark Salsbery2-Jun-09 8:07 
General[Message Deleted] Pin
fjparisIII2-Jun-09 8:22
fjparisIII2-Jun-09 8:22 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 8:34
Mark Salsbery2-Jun-09 8:34 
General[Message Deleted] Pin
fjparisIII2-Jun-09 9:25
fjparisIII2-Jun-09 9:25 
QuestionRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 11:29
Mark Salsbery2-Jun-09 11:29 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII7-Jun-09 7:11
fjparisIII7-Jun-09 7:11 
QuestionWPF TreeViewItem Header Binding Pin
Etienne_12330-May-09 3:34
Etienne_12330-May-09 3:34 
AnswerRe: WPF TreeViewItem Header Binding Pin
Mark Salsbery31-May-09 9:17
Mark Salsbery31-May-09 9:17 
GeneralRe: WPF TreeViewItem Header Binding Pin
Etienne_12331-May-09 19:50
Etienne_12331-May-09 19:50 
GeneralRe: WPF TreeViewItem Header Binding Pin
Mark Salsbery31-May-09 20:36
Mark Salsbery31-May-09 20:36 
QuestionWPF and XML question Pin
Etienne_12330-May-09 1:59
Etienne_12330-May-09 1:59 
AnswerRe: WPF and XML question Pin
Pete O'Hanlon30-May-09 10:37
mvePete O'Hanlon30-May-09 10:37 
QuestionNumber updown control in WPF Pin
Nekkantidivya30-May-09 0:48
Nekkantidivya30-May-09 0:48 
AnswerRe: Number updown control in WPF Pin
ABitSmart30-May-09 1:41
ABitSmart30-May-09 1:41 
AnswerRe: Number updown control in WPF Pin
fjparisIII30-May-09 9:01
fjparisIII30-May-09 9:01 
QuestionWebbrowser control in Silver light Pin
Nekkantidivya29-May-09 19:43
Nekkantidivya29-May-09 19:43 

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

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