Click here to Skip to main content
15,885,546 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois25-Apr-23 19:08
professionalKevin Marois25-Apr-23 19:08 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz26-Apr-23 5:20
mveGerry Schmitz26-Apr-23 5:20 
QuestionReport Designer Suggestions Pin
Kevin Marois13-Apr-23 13:37
professionalKevin Marois13-Apr-23 13:37 
AnswerRe: Report Designer Suggestions Pin
Pete O'Hanlon13-Apr-23 21:23
mvePete O'Hanlon13-Apr-23 21:23 
AnswerRe: Report Designer Suggestions Pin
Gerry Schmitz14-Apr-23 3:51
mveGerry Schmitz14-Apr-23 3:51 
QuestionCustom Navigation Control Pin
Kevin Marois12-Apr-23 16:23
professionalKevin Marois12-Apr-23 16:23 
AnswerRe: Custom Navigation Control Pin
Pete O'Hanlon13-Apr-23 21:36
mvePete O'Hanlon13-Apr-23 21:36 
AnswerRe: Custom Navigation Control Pin
Richard Deeming13-Apr-23 22:47
mveRichard Deeming13-Apr-23 22:47 
Kevin Marois wrote:
Each pane must load independant of the other
That doesn't seem to tally with:
Kevin Marois wrote:
C#
foreach (var navigationPaneModel in NavigationPanes)
{
    await Task.Run(() =>
    {
        // Go the the back end & get the data
        return _apiProxy.GetNavigationItems(navigationPaneModel.NavigationItemType);
    }).ContinueWith(task =>
    {
        App.Current.Dispatcher.BeginInvoke(() =>
        {
            // Find the container for the data
            var container = ContainerItems.FirstOrDefault(x => x.NavigationItemType == navigationPaneModel.NavigationItemType);
            if (container != null && task.Result != null)
            {
                // Assign the data to it
                container.Items = new ObservableCollection<NavigationEntity>(task.Result);
            }
        });
    });
}
Your loop kicks off a task to load each pane, then waits for that task to complete before trying to load the next pane.

Try extracting the "load a pane" code to a separate method:
C#
private async Task LoadPane(NavigationPane navigationPaneModel)
{
    var result = await Task.Run(() => _apiProxy.GetNavigationItems(navigationPaneModel.NavigationItemType);
    if (result is null) return;
    
    var container = ContainerItems.FirstOrDefault(x => x.NavigationItemType == navigationPaneModel.NavigationItemType);
    if (container is null) return;
    
    container.Items = new ObservableCollection<NavigationEntity>(result);
}
Then change the loop to:
C#
List<Task> tasks = new List<Task>(NavigationPanes.Count);
foreach (var navigationPaneModel in NavigationPanes)
{
    tasks.Add(LoadPane(navigationPaneModel));
}

await Task.WhenAll(tasks);



Kevin Marois wrote:
C#
control.IsBusyVisible = Visibility.Collapsed;  //<==== THIS IS BEING HIT, BUT THE INDICATOR STILL SHOWS. AND NO DATA ITEMS APPEAR
You've declared the IsBusyVisible property as a regular property, but your NavigationPane class is a DependencyObject. The WPF binding system will only observe changes to DependencyProperty properties on a DependencyObject-derived class. Change the property to a dependency property:
C#
public static readonly DependencyProperty IsBusyVisibleProperty = DependencyProperty.Register(
    "IsBusyVisible", typeof(Visibility), typeof(NavigationPane),
    new PropertyMetadata(Visibility.Visible));

public Visibility IsBusyVisible
{
    get { return (Visibility)GetValue(IsBusyVisibleProperty); }
    set { SetValue(IsBusyVisibleProperty, value); }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Custom Navigation Control Pin
Kevin Marois15-Apr-23 10:22
professionalKevin Marois15-Apr-23 10:22 
GeneralRe: Custom Navigation Control Pin
Pete O'Hanlon16-Apr-23 21:54
mvePete O'Hanlon16-Apr-23 21:54 
GeneralRe: Custom Navigation Control Pin
Kevin Marois17-Apr-23 5:10
professionalKevin Marois17-Apr-23 5:10 
GeneralRe: Custom Navigation Control Pin
Pete O'Hanlon17-Apr-23 10:52
mvePete O'Hanlon17-Apr-23 10:52 
GeneralRe: Custom Navigation Control Pin
Kevin Marois22-Apr-23 17:54
professionalKevin Marois22-Apr-23 17:54 
GeneralRe: Custom Navigation Control Pin
Pete O'Hanlon23-Apr-23 21:09
mvePete O'Hanlon23-Apr-23 21:09 
GeneralRe: Custom Navigation Control Pin
Richard Deeming23-Apr-23 23:07
mveRichard Deeming23-Apr-23 23:07 
GeneralRe: Custom Navigation Control Pin
Kevin Marois25-Apr-23 19:02
professionalKevin Marois25-Apr-23 19:02 
GeneralRe: Custom Navigation Control Pin
Kevin Marois27-Apr-23 7:21
professionalKevin Marois27-Apr-23 7:21 
QuestionPath in Style Question Pin
Kevin Marois10-Apr-23 13:43
professionalKevin Marois10-Apr-23 13:43 
AnswerRe: Path in Style Question Pin
Gerry Schmitz12-Apr-23 6:18
mveGerry Schmitz12-Apr-23 6:18 
GeneralRe: Path in Style Question Pin
Kevin Marois12-Apr-23 6:33
professionalKevin Marois12-Apr-23 6:33 
GeneralRe: Path in Style Question Pin
Gerry Schmitz12-Apr-23 7:01
mveGerry Schmitz12-Apr-23 7:01 
GeneralRe: Path in Style Question Pin
Kevin Marois12-Apr-23 7:06
professionalKevin Marois12-Apr-23 7:06 
GeneralRe: Path in Style Question Pin
Kevin Marois18-Apr-23 14:45
professionalKevin Marois18-Apr-23 14:45 
QuestionDraw Images Pin
Kevin Marois4-Apr-23 14:24
professionalKevin Marois4-Apr-23 14:24 
AnswerRe: Draw Images Pin
Andy_L_J5-Apr-23 1:41
Andy_L_J5-Apr-23 1:41 

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.