Click here to Skip to main content
15,904,348 members
Home / Discussions / WPF
   

WPF

 
QuestionNavigationControl - Still Have A Problem Pin
Kevin Marois25-Aug-23 11:30
professionalKevin Marois25-Aug-23 11:30 
Question[Solved/Workaround] Floating progress visualization with button control Pin
Evilfish20009-Aug-23 23:28
Evilfish20009-Aug-23 23:28 
AnswerRe: Floating progress visualization with button control Pin
Richard Deeming10-Aug-23 0:26
mveRichard Deeming10-Aug-23 0:26 
GeneralRe: Floating progress visualization with button control Pin
Evilfish200010-Aug-23 0:47
Evilfish200010-Aug-23 0:47 
AnswerRe: Floating progress visualization with button control Pin
Gerry Schmitz10-Aug-23 6:11
mveGerry Schmitz10-Aug-23 6:11 
QuestionWPF EF Core 6 DP Question Pin
Kevin Marois24-Jul-23 14:42
professionalKevin Marois24-Jul-23 14:42 
AnswerRe: WPF EF Core 6 DP Question Pin
Richard Deeming24-Jul-23 21:36
mveRichard Deeming24-Jul-23 21:36 
GeneralRe: WPF EF Core 6 DP Question Pin
Kevin Marois25-Jul-23 8:10
professionalKevin Marois25-Jul-23 8:10 
GeneralRe: WPF EF Core 6 DP Question Pin
Richard Deeming25-Jul-23 21:41
mveRichard Deeming25-Jul-23 21:41 
GeneralRe: WPF EF Core 6 DP Question Pin
Kevin Marois27-Jul-23 19:27
professionalKevin Marois27-Jul-23 19:27 
GeneralRe: WPF EF Core 6 DP Question Pin
Richard Deeming30-Jul-23 21:55
mveRichard Deeming30-Jul-23 21:55 
QuestionWPF xceed CheckcComboBox SelectAll Text Pin
Kevin Marois20-Jun-23 18:17
professionalKevin Marois20-Jun-23 18:17 
AnswerRe: WPF xceed CheckcComboBox SelectAll Text Pin
Richard Deeming20-Jun-23 20:53
mveRichard Deeming20-Jun-23 20:53 
GeneralRe: WPF xceed CheckcComboBox SelectAll Text Pin
Kevin Marois21-Jun-23 10:32
professionalKevin Marois21-Jun-23 10:32 
QuestionList of Images Pin
Kevin Marois9-Jun-23 13:47
professionalKevin Marois9-Jun-23 13:47 
QuestionChange Image URL's Assembly At Runtime Pin
Kevin Marois6-Jun-23 7:15
professionalKevin Marois6-Jun-23 7:15 
AnswerRe: Change Image URL's Assembly At Runtime Pin
Gerry Schmitz6-Jun-23 15:52
mveGerry Schmitz6-Jun-23 15:52 
Questionc# Spotify API not returning correctly. Pin
elfenliedtopfan52-Jun-23 18:03
elfenliedtopfan52-Jun-23 18:03 
AnswerRe: c# Spotify API not returning correctly. Pin
Pete O'Hanlon4-Jun-23 8:42
mvePete O'Hanlon4-Jun-23 8:42 
AnswerRe: c# Spotify API not returning correctly. Pin
jschell5-Jun-23 5:01
jschell5-Jun-23 5:01 
QuestionNeed help please regarding your awesome WPF MultiComboBox project :) Pin
Member 1160463425-May-23 5:21
Member 1160463425-May-23 5:21 
AnswerRe: Need help please regarding your awesome WPF MultiComboBox project :) Pin
jeron125-May-23 5:50
jeron125-May-23 5:50 
AnswerRe: Need help please regarding your awesome WPF MultiComboBox project :) Pin
Richard Deeming25-May-23 21:28
mveRichard Deeming25-May-23 21:28 
QuestionNavigationControl - Part 3 Pin
Kevin Marois14-May-23 8:01
professionalKevin Marois14-May-23 8:01 
So I am continuing to work on my Navigation Control[^]. See this[^] and this[^]. The code is in this repo[^].

Special thanks to Richard Deeming for all your help so far. I've learned alot from you.

If you look at the image of the control in the first link above, you 'll see 3 sections, with the 3rd still loading. The expanders can be openend either by the user, or by saving & restoring a bool. On the NavigationPane control there's a DP called IsPaneExpanded. This get called with from the user or by the restoring during load.

When the control is being initialized I store the value of the DP.
Fields
// Stores the value of the DP IsPaneExpanded during initialization. See
// comments in the DP IsPaneExpanded 
private bool _isPaneExpanded = false;

// Set to true after the control has finished initializing
private bool _isInitialized = false;
IsPaneExpanded DP
public static readonly DependencyProperty IsPaneExpandedProperty =
            DependencyProperty.Register("IsPaneExpanded",
            typeof(bool),
            typeof(NavigationPane),
            new PropertyMetadata(false, new PropertyChangedCallback(OnIsPaneExpandedChanged)));

public bool IsPaneExpanded
{
    get { return (bool)GetValue(IsPaneExpandedProperty); }
    set { SetValue(IsPaneExpandedProperty, value); }
}

private static async void OnIsPaneExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    var control = (NavigationPane)d;

    if (!control._isInitialized)
    {
        // If here, the control is still being initialized. Store the
        // IsPaneExpanded setting for later use when the control's init
        // has finished
        control._isPaneExpanded = control.IsPaneExpanded;

        // Since the control is not loaded, there is nothing to show. But
        // since the IsExpanded can be set from the Window, and it's bound,
        // it's possible for the expander arrow to show open even though
        // there's nothing there. So force the expander to show as collapsed
        control.IsPaneExpanded = false;
    }
    else
    {
        // If here, the control has already been initialized, so go ahead
        // and call load. If here, the user clicked the expander arrow.
        if (control.IsPaneExpanded)
        {
            await control.Load();
        }
    }
}

Then, once initialzation is complete, I check that to see if the control's expander should be expanded.

Problem 1
The problem above is that the _isPaneExpanded is always false by the time it gets here. It IS being set to True in the DP, yet once the code reaches this point, it's false, so the load never happens. Maybe it's because the DP is static and the field isn't?

Problem 2
Another issue I see - I'd like the expander to open visuall FIRST, then call load. The Expander's Expanded event fires AFTER it has opened, but BEFORE the user sees anything visually the load is firing. Nothing changes visually until AFTER the load is complete.
private async void NavigationPane_Initialized(object? sender, EventArgs e)
{
    // If the control's IsPaneExpanded was set from the parent, then
    // the IsPandedExpanded DP would have set _isPaneExpanded = true.
    if (_isPaneExpanded) <==================================================== PROBLEM 1 HERE
    {
        // Now that the control has finished initializing, go ahead
        // and call load

        <=============================== PROBLEM 2 HERE. HOW DO YOU FORCE THE EXPANDER TO SHOW AS OPEN BEFORE LOAD
        await Load();
    }

    _isInitialized = true;
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 14-May-23 16:37pm.

AnswerRe: NavigationControl - Part 3 Pin
Richard Deeming14-May-23 21:40
mveRichard Deeming14-May-23 21:40 

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.