Click here to Skip to main content
15,036,441 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF DataGrid Custom Group Header Pin
Richard Deeming22-Mar-21 22:35
mveRichard Deeming22-Mar-21 22:35 
QuestionDynamic WPF DataGrid Pin
Kevin Marois19-Mar-21 10:41
professionalKevin Marois19-Mar-21 10:41 
AnswerRe: Dynamic WPF DataGrid Pin
Richard Deeming21-Mar-21 22:50
mveRichard Deeming21-Mar-21 22:50 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois22-Mar-21 7:07
professionalKevin Marois22-Mar-21 7:07 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois23-Mar-21 9:58
professionalKevin Marois23-Mar-21 9:58 
GeneralRe: Dynamic WPF DataGrid Pin
Richard Deeming23-Mar-21 23:13
mveRichard Deeming23-Mar-21 23:13 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois24-Mar-21 6:14
professionalKevin Marois24-Mar-21 6:14 
QuestionWPF with TPL Multithreading Pin
#realJSOP16-Mar-21 6:04
mva#realJSOP16-Mar-21 6:04 
Using VS2019, .Net framework 4.72:

I wrote a simple app that has a collection class (derived from ObservableCollection) of items (that inherit from INotifyPropertyChanged). I'm specifying 5 items to process.

Each of these items has a DoWork method that simply sits and spins for a randomly selected amount of time (from 1 to 30 seconds). While an item is "spinning", it updates a Progress property, as well as a Status property. The updates to these properties are intended to update the UI.

The observable collection class contains a method that does the following:

public void Start()
{
    try
    {
        var list = this.Where(x=>x.Status == WorkerStatus.NotStarted);
        Parallel.ForEach(list, this.options, worker=>
        {
            worker.DoWork(options.CancellationToken);
            // notice I'm not awaiting anything, so this call returns
            // immediately to the UI method that called it.
        });
    }
    catch (OperationCanceledException ex)
    {
        if (ex != null) { }
    }
}


I'm not getting any exceptions, but the UI updates appears to reflect item status updates all at the same time.

In an attempt to fix the update issue, I call this method from the Progress and Status property set method

private void DispatcherNotify(params string[] propertyNames)
{
    Dispatcher.CurrentDispatcher.Invoke(()=>
    {
        foreach(string name in propertyNames)
        {
            this.NotifyPropertyChanged(name); 
            Debug.WriteLine("{0} - {1}", this.IDName, name);
        }
    });
}


I have verified that this method is indeed being called as expected, but the UI isn't updating (each "item" has its own UI component that is supposed to be updated).

The UI status update is handled by a converter, and that converter is called for all five items , but only when all 5 items have finished processing.

What am I doing wrong?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

AnswerRe: WPF with TPL Multithreading Pin
Gerry Schmitz16-Mar-21 7:45
mveGerry Schmitz16-Mar-21 7:45 
GeneralRe: WPF with TPL Multithreading Pin
#realJSOP16-Mar-21 9:03
mva#realJSOP16-Mar-21 9:03 
GeneralRe: WPF with TPL Multithreading Pin
Gerry Schmitz16-Mar-21 10:11
mveGerry Schmitz16-Mar-21 10:11 
GeneralRe: WPF with TPL Multithreading Pin
#realJSOP16-Mar-21 10:51
mva#realJSOP16-Mar-21 10:51 
QuestionExpand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
ernie_hudds12-Mar-21 4:24
Memberernie_hudds12-Mar-21 4:24 
AnswerRe: Expand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
Gerry Schmitz12-Mar-21 8:13
mveGerry Schmitz12-Mar-21 8:13 
AnswerRe: Expand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
lmoelleb15-Mar-21 8:40
Memberlmoelleb15-Mar-21 8:40 
QuestionAvalonDock using AvalonDock.ManagedContent not present in Dirkster.AvalonDock package Pin
sinagot4-Mar-21 1:24
Membersinagot4-Mar-21 1:24 
AnswerRe: AvalonDock using AvalonDock.ManagedContent not present in Dirkster.AvalonDock package Pin
Gerry Schmitz4-Mar-21 8:24
mveGerry Schmitz4-Mar-21 8:24 
GeneralRe: AvalonDock using AvalonDock.ManagedContent not present in Dirkster.AvalonDock package Pin
sinagot4-Mar-21 10:50
Membersinagot4-Mar-21 10:50 
QuestionDataGrid Columnm Header Style Pin
Kevin Marois16-Feb-21 14:44
professionalKevin Marois16-Feb-21 14:44 
AnswerRe: DataGrid Columnm Header Style Pin
Gerry Schmitz17-Feb-21 6:14
mveGerry Schmitz17-Feb-21 6:14 
QuestionGridView CellTemplate Pin
#realJSOP13-Feb-21 10:42
mva#realJSOP13-Feb-21 10:42 
AnswerRe: GridView CellTemplate Pin
Gerry Schmitz13-Feb-21 12:50
mveGerry Schmitz13-Feb-21 12:50 
GeneralRe: GridView CellTemplate Pin
#realJSOP13-Feb-21 13:13
mva#realJSOP13-Feb-21 13:13 
AnswerRe: GridView CellTemplate Pin
#realJSOP14-Feb-21 4:49
mva#realJSOP14-Feb-21 4:49 
GeneralRe: GridView CellTemplate Pin
Gerry Schmitz14-Feb-21 5:53
mveGerry Schmitz14-Feb-21 5:53 

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.