Forum Discussion
paulhollyer
Mar 07, 2023Copper Contributor
How to Control a XAML element from code behind?
Hi all,
I'm new to the `.dotnet` ecosystem, and recently started learning C# and Maui - wish I'd done this sooner.
I have a couple of questions for which I'm not necessarily looking for answers in code, sudo-code/explanation is fine:
1. What would be the recommended approach to setting up a form that displays errors? The problem I'm having trouble with is the conditional display of the errors in the XAML.
2. How do you control a XAML element from the codebehind/viewmodel? I've tried interacting with an element's `x:Name` but not having much joy.
I'm using .Net 7.0
Many thanks for any feedback provided.
Paul
1 Reply
- paulhollyerCopper ContributorOk my mistake, I can interact with Xaml elements using the `x:Name` property value in the codebehind, I was in the viewmodel....
I should be able to resolve both questions now, but any advice on anything related is always appreciated.