Click here to Skip to main content
15,910,661 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 8:55
mveGerry Schmitz23-Apr-23 8:55 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois23-Apr-23 9:15
professionalKevin Marois23-Apr-23 9:15 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 15:28
mveGerry Schmitz23-Apr-23 15:28 
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 
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 
The first obvious issue: the ContainerItems property is not a dependency property. As I said, for a DependencyObject-derived class, WPF will only observe property changes for dependency properties.
C#
public static readonly DependencyProperty ContainerItemsProperty
    = DependencyProperty.Register("ContainerItems",
        typeof(List<NavigationPane>),
        typeof(NavigationContainer),
        new PropertyMetadata(null));

public List<NavigationPane> ContainerItems
{
    get { return (List<NavigationPane>)GetValue(ContainerItemsProperty); }
    set { SetValue(ContainerItemsProperty, value); }
}

Next problem: since you're using a List<T> rather than an ObservableCollection<T>, WPF will only notice when you set the property. Since you do that before adding any items to the list, WPF will never notice the panes being loaded. Change the code to set the property after populating the list:
C#
private async Task Load()
{
    if (NavigationPanes != null)
    {
        var items = new List<NavigationPane>();

        List<Task> tasks = new List<Task>(NavigationPanes.Count);
        foreach (var navigationPaneModel in NavigationPanes)
        {
            tasks.Add(LoadPane(navigationPaneModel, items));
        }

        await Task.WhenAll(tasks);
		ContainerItems = items;
	}
}

private async Task LoadPane(NavigationPaneModel navigationPaneModel, List<NavigationPane> containerItems)

With those changes in place (and dropping the Thread.Sleep values so it loads in a reasonable time), I now get four expanders in the list. However, although they have different headers, none of them contain any data.

Looking in the Generic.xaml file, you're binding the Header property, but not the Items property:
XAML
<ctrls:NavigationPane BorderBrush="Yellow" 
    BorderThickness="1"
    Background="Red"
    HorizontalAlignment="Stretch"
    Header="{Binding Header}"
    Margin="0,0,0,1"/>
Once you add Items="{Binding Items}" to that, the listboxes are now populated.



"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 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 

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.