Description
Describe the problem this feature would solve
We currently use the Behaviors package (via the Toolkit) to ensure all properties are loaded before we initialize the Graph via our XAML Provider helpers. This is a larger dependency (and causes more issues with our dependency issue from #66) for this small benefit. We should use an alternate solution to provide the same benefit without the overhead.
Describe the solution
We should add an attached property for Page (or maybe Control/FrameworkElement) which is named something like GraphProvider
and accepts one of our Graph Providers. This would when the property is set, look at Loaded
event for the attached FrameworkElement
parent and at that point call our Initialize
method on the set provider.
This would allow the Initialize
method to still have access to all the property values we need on the providers to initialize the graph components, but without the need for the full Behaviors package which we utilize no other parts from.
Initialization Before
<Page
...
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:providers="using:Microsoft.Toolkit.Graph.Providers">
<Interactivity:Interaction.Behaviors>
<providers:InteractiveProviderBehavior ClientId="YOUR_CLIENT_ID_HERE" Scopes="User.Read,User.ReadBasic.All,People.Read"/>
</Interactivity:Interaction.Behaviors>
</Page>
Initialization After
<Page
...
xmlns:providers="using:Microsoft.Toolkit.Graph.Providers">
<providers:Extensions.GraphProvider>
<providers:InteractiveProvider ClientId="YOUR_CLIENT_ID_HERE" Scopes="User.Read,User.ReadBasic.All,People.Read"/>
</providers:Extensions.GraphProvider>
</Page>
Other Considerations
We currently ship a WPF based package for our providers for use within XAML Islands. Not sure if we'd still want to ship a similar solution or not, we'd have to discuss. It was a bit easier before as we could leverage the same behavior code pretty easily between the two, not sure if this solution would be similar...