Skip to content

Conversation

@mrlacey
Copy link

@mrlacey mrlacey commented Jan 8, 2026

Fixes 56

Fixes #56

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

Can get NREs

What is the new behavior?

Avoids these exceptions by adding suitable null checks.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest dev branch of XAML Studio
  • Tested code with current supported SDKs
  • Contains NO breaking changes to save/state files

Other information

@michael-hawker
Copy link
Contributor

Thanks @mrlacey! Took me a second to realize what you meant issue, but I see now about clicking on the main navigation view items. You're actually not supposed to be able to click on them without a document loaded... 😅

Looks like in the change to #3 that I broke the logic for ViewModel.IsEditingDocument in the MainViewModel somehow which should disable those buttons:

<muxc:NavigationViewItem x:Uid="MainPage_NavMenu_DataSources"
IsEnabled="{x:Bind ViewModel.IsEditingDocument, Mode=OneWay}"
Tag="DATASOURCES">
<muxc:NavigationViewItem.Icon>
<lcontrols:AppFontIcon IconName="Wheel" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="MainPage_NavMenu_Debug"
IsEnabled="{x:Bind ViewModel.IsEditingDocument, Mode=OneWay}"
Tag="DEBUG">
<muxc:NavigationViewItem.Icon>
<lcontrols:AppFontIcon IconName="Bug" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="MainPage_NavMenu_Properties"
IsEnabled="{x:Bind ViewModel.IsEditingDocument, Mode=OneWay}"
Tag="PROPERTIES">
<muxc:NavigationViewItem.Icon>
<lcontrols:AppFontIcon IconName="Properties" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="MainPage_NavMenu_Toolbox"
IsEnabled="{x:Bind ViewModel.IsEditingDocument, Mode=OneWay}"
Tag="TOOLBOX">
<muxc:NavigationViewItem.Icon>
<lcontrols:AppFontIcon IconName="Work" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

I see, it used to be that they were defined based on if the Welcome/Settings activity was open:

public bool IsEditingDocument => OpenActivity != "SETTINGS" && OpenActivity != "WELCOME";

The problem is you can still click on "Explorer", but then from there get to any of the others... 🤔

I think this can be fixed by ensuring the ActiveFile is set as part of this condition instead or that OpenFiles count is not zero.

Let me know your thoughts!

@mrlacey
Copy link
Author

mrlacey commented Jan 8, 2026

If you can style them so it's clear they're not enabled then maybe do that. But then I'd wonder why they weren't enabled. I was having a poke around because I hadn't used it in a long time. I proposed a quick fix for an issue that is clearly something you're very unlikely to do once familiar with the app you are unlikely to try and do anything without a document open.

If I was you, I'd take this fix (it's rarely bad to add extra null checking) and then address what should be enabled (& when) as part of looking at improving the OOBE experience

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullReferenceExceptions if using the main menus with no document open

2 participants