docs-maui icon indicating copy to clipboard operation
docs-maui copied to clipboard

C# examples not available

Open HobDev opened this issue 2 years ago • 2 comments

The docs say .NET Multi-platform App UI (.NET MAUI) triggers allow you to express actions declaratively in XAML that change the appearance of controls based on events or data changes. But why it can't be used with C# UI. If it can be then please add examples of C# UI too.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

  • ID: 4d235822-6844-24ce-55e7-2515d3c023b2
  • Version Independent ID: 4d235822-6844-24ce-55e7-2515d3c023b2
  • Content: Triggers - .NET MAUI
  • Content Source: docs/fundamentals/triggers.md
  • Product: dotnet-mobile
  • Technology: dotnet-maui
  • GitHub Login: @davidbritch
  • Microsoft Alias: dabritch

HobDev avatar Jun 07 '23 11:06 HobDev

Hi @HobDev

The whole point to triggers is making it easy to do things in XAML that would traditionally be accomplished in C#. So while you could use triggers in C#, there's often better ways of doing the same thing in C#. For example, an EventTrigger would be an event handler in C#. A DataTrigger would be code in a setter in C# etc.

davidbritch avatar Jun 19 '23 10:06 davidbritch

Thanks @davidbritch for the information. Your above comment along with an example would be a great addition to the docs.

HobDev avatar Jun 22 '23 00:06 HobDev