-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
feature request π¬A request for new changes to improve functionalityA request for new changes to improve functionality
Description
Describe the problem this feature would solve
Currently InAppNotification does not support DataTemplateSelector.
Consider the following XAML:
<ctcontrols:InAppNotification x:Name="InAppNotification" ShowDismissButton="False" StackMode="StackInFront" Style="{ThemeResource MSEdgeNotificationStyle}">
<ctcontrols:InAppNotification.Resources>
<DataTemplate x:Key="TextOnly">
...
</DataTemplate>
<DataTemplate x:Key="CustomContent">
...
</DataTemplate>
<DataTemplate x:Key="TextWithButtons">
...
</DataTemplate>
<DataTemplate x:Key="CustomContentWithButtons">
...
</DataTemplate>
</ctcontrols:InAppNotification.Resources>
<ctcontrols:InAppNotification.ContentTemplateSelector>
<ciiwinui:ArgumentKeyTemplateSelector ArgumentKeyName="NotificationTemplateType">
<ciiwinui:ArgumentKeyTemplateSelector.DataTemplates>
<StaticResource x:Key="TextOnly" ResourceKey="TextOnly" />
<StaticResource x:Key="CustomContent" ResourceKey="CustomContent" />
<StaticResource x:Key="TextWithButtons" ResourceKey="TextWithButtons" />
<StaticResource x:Key="CustomContentWithButtons" ResourceKey="CustomContentWithButtons" />
</ciiwinui:ArgumentKeyTemplateSelector.DataTemplates>
</ciiwinui:ArgumentKeyTemplateSelector>
</ctcontrols:InAppNotification.ContentTemplateSelector>
</ctcontrols:InAppNotification>
And when I say:
dynamic arguments = new ExpandoObject();
arguments.NotificationTemplateType = "TextOnly";
arguments.Text = "Notification text comes here.";
notification.Dismiss();
notification.Show(arguments);
The template selector ArgumentKeyTemplateSelector does not take any effect and SelectTemplateCore not fired.
Describe the solution
InAppNotification is a great control to show notifications in my app. But I feel difficult to reuse the DataTemplate for same kind of content, or choose different DataTemplate for different content. I think DataTemplateSelector is a good way to resolve this.
Describe alternatives you've considered
InAppNotification.Show may also need to provide an overload like:
void Show(object content, DataTemplate dataTemplate, int duration = 0);
We can be able to choose different templates according to the content we want to show.
Metadata
Metadata
Assignees
Labels
feature request π¬A request for new changes to improve functionalityA request for new changes to improve functionality