Skip to content

Cannot Access Second Defined XAML Toolkit Expander on WinUI 3. #4740

Discussion options

You must be logged in to vote

@berkbb your Expander you call out is part of a DataTemplate here:

https://github.com/berkbb/tower_winui_case/blob/fbcbc31dbb701573f161d05c752e6d2f1cfca802/BBCase/Views/MainPage.xaml#L54-L55

You can't reference things in template in your code behind like that.

You should be using data Binding on a property on the item the template represents to tackle handling the expanded state. In your case you're really using this for some function of the size of the window, in which case you should use an adaptive state trigger for a Visual State Manager to toggle the property.

This isn't an issue with the Toolkit.

Replies: 6 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by michael-hawker
Comment options

You must be logged in to vote
1 reply
@michael-hawker
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question ❔ Issues or PR require more information by design external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. WinUI 💠 Related to WinUI 3 Version or when paired with External can mean requires fix in WinUI 2/3.
2 participants
Converted from issue

This discussion was converted from issue #4722 on August 26, 2022 20:18.