Loading...

Dataverse for Teams vs Canvas Apps - Part 1 - Checked vs Default Control Properties

Dataverse for Teams vs Canvas Apps - Part 1 - Checked vs Default Control Properties

If you were thinking that Power Apps Canvas Apps and Dataverse for Teams Canvas Apps are just the same – but with a different license and container – well whilst it is mostly true, there is a very big difference:
Dataverse for Teams uses a completely different set of Out of the Box controls. They are based on the Fluent UI library.
This post will hopefully save someone the time that I’ve spent investigating why a very common UI design pattern doesn’t work in Dataverse for Teams.

The Toggle Pattern

A common pattern in Canvas Apps is to bind a variable to the Default property of a Toggle Button, and then use the OnChange event to fire some code when it is changed. This is a very common solution to the problem that components cannot raise events at the time of writing.
Imagine a scenario where you have a Component that renders a button, that when selected it should raise an event on the hosting screen.
The common pattern is to toggle an output property from a custom component, and then bind the output to a variable – that is in turn bound to a toggle button. When the variable is toggled, it then raises the OnChecked event on the toggle button so you can perform the logic you need. This does seem like a hack – but it is the only mechanism I know of to respond to events from inside components.

I hope that at some point we will see custom events being able to be defined inside components – but for now, the workaround remains.
So, the app looks something like this:

Fluent UI Controls not only look different - they behave differently!

The problem is that inside Dataverse for Teams, the standard controls have been replaced with the new Fluent UI based controls, and with that, there is a subtle difference.

The default property has been replaced by a new set of properties that are control specific (e.g. Checked, Value, Text, etc). With this change, the change events are only fired with the user initiates the event – and not when the app changes the value.

So in Dataverse for Teams, the App looks very similar, but with the Checked property rather than Default:

This results in the OnChecked event not being fired and as such, the pattern no longer works.

If you look carefully, you'll see, in Dataverse for Teams, the label counter only increments when the toggle button is checked but not when the button is clicked. This is because the OnChecked event is not triggered by the varToggle variable being changed by the component.

I really love the Fluent UI controls in Dataverse for Teams - especially with the awesome responsive layout controls - but this drawback is very limiting if you are used to writing Power Apps Canvas Apps. I hope that we will see an update soon that will remove this limitation from Dataverse for Teams Apps.

Work Around

Update 2021-02-10: There is a workaround to this - you can enable 'classic' controls - this then gives you the choice between using the Fluent UI OR the classic Toggle control. By using the classic control you then get the OnChecked event being raised!

 

Published on:

Learn more
Develop 1 - Dynamics 365 Architecture Services
Develop 1 - Dynamics 365 Architecture Services

Share post:

Related posts

How to access multi-level hierarchical parental table columns in canvas app gallery

Learn How to access multi-level hierarchical parental table columns in canvas app gallery. Use Dot Operator to access. WAtch full video here. ...

4 days ago

Paging in Gallery in Canvas App Power Apps

You can easily implement paging concept for your gallery in canvas APP. follow below steps to achieve this. watch full video here or read the ...

5 days ago

Paper to Power App: Creating a Canvas App in D365 CRM from a Hand-Drawn Sketch

Power Apps, known for its low-code/no-code capabilities, now offers the ability to create complete apps from an image. Sometimes, the best way...

8 days ago

Integrate Your Custom Copilot into Your Canvas App in Power Apps

Microsoft Copilot Studio allows creators to build tailored Copilots powered by AI effortlessly. In a few simple steps, you can implement your ...

29 days ago

Dynamics 365 Embedded Canvas Apps in Model-Driven Power Apps

Introduction In an era where business evolves at lightning speed, leveraging the latest technology is crucial for success. Dynamics 365,…...

1 month ago

Use Copilot to quickly filter, sort, and search canvas app galleries with SQL Server

We are excited to announce that Power Apps application runtime users can now use Copilot to quickly filter, sort, and search the items in canv...

1 month ago

Canvas App | Simplified Display of SVG Images

In one of my previous articles : Display an SVG icon in CanvasĀ App ,I explained how to display an SVG icon using an Image control. While this ...

2 months ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy