C
C#3y ago
SirDigby

WinUI3 - Button always disabled [Answered]

I'm writing a desktop app using .Net 6.0 and WinUI3. I initially created the project using Template Studio for WinUI. I've run into an issue where some buttons (Microsoft.UI.Xaml.Controls.Button) are getting disabled for no apparent reason. There is nothing in the xaml or code-behind that changes the IsEnabled property, and even if I do set it explicitly to true they stay disabled. By watching the IsEnabledChanged event I can see something is setting the value to false but the callstack just has methods from the WinUI library. Any ideas for how to fix this or how to better diagnose what may be the cause would be appreciated. Thanks!
3 Replies
Buddy
Buddy3y ago
Do you use Commands?
SirDigby
SirDigbyOP3y ago
Yeah. I actually just figured it out. The bound function takes a parameter and I hadn't defined the CommandParameter for them. Kind of annoying there isn't any feedback for that being the cause, though
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server