Describe the bug
Many samples need the option to perform an action or demonstrate a triggered event (like a notification for instance).
For instance, the current notification behavior needs to have button as part of its sample code:
https://github.com/CommunityToolkit/Labs-Windows/blob/ce74acf608383502e42cd903b660d45f281281bb/components/StackedNotificationsBehavior/samples/StackedNotificationsBehaviorCustomSample.xaml#L14-L17
We should instead be able to show this as part of the sidebar of options available for the sample to present these types of actions in a consistent pattern and minimize the XAML to be that which is required for the feature in typical usage.
Steps to reproduce
Expected behavior
Proposal:
[ToolkitSampleButtonAction(string commandName, string buttonLabel, string methodName, bool isVisible = true)]
[ToolkitSampleButtonAction("SendMessage", "Send Notification", nameof(SendNotificationMessage), Title = "Optional Header"]
public sealed partial class MySimpleSample : Page
{
public MySimpleSample()
{
this.InitializeComponent();
}
public void SendNotificationMessage()
{
// Code to run when button is clicked
}
This would create a button on the side panel which when clicked would execute the method of the given sample class, in the above TestMethod. It would also create a named SendMessageCommand which could be leveraged in the sample XAML code for other purposes as well if some embedded UI element also needed a command version of it to trigger in an alternate way or if isVisible is set to false to use just as a command but not show in the sidebar.
Don't think there's a better way to connect the method to the attribute... @Sergio0694? I suppose we could put the attribute on the method in the class instead? Would separate it from our other options, but make it clearer and remove the need for nameof. Would also make it easier if we wanted to remove that method from the displayed sample code:
public sealed partial class MySimpleSample : Page
{
public MySimpleSample()
{
this.InitializeComponent();
}
[ToolkitSampleButtonAction("SendMessage", "Send Notification", Title = "Optional Header"]
public void SendNotificationMessage()
{
// Code to run when button is clicked
}
Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
No response
Visual Studio Build Number
No response
Device form factor
No response
Additional context
No response
Help us help you
Yes, but only if others can assist.
Describe the bug
Many samples need the option to perform an action or demonstrate a triggered event (like a notification for instance).
For instance, the current notification behavior needs to have button as part of its sample code:
https://github.com/CommunityToolkit/Labs-Windows/blob/ce74acf608383502e42cd903b660d45f281281bb/components/StackedNotificationsBehavior/samples/StackedNotificationsBehaviorCustomSample.xaml#L14-L17
We should instead be able to show this as part of the sidebar of options available for the sample to present these types of actions in a consistent pattern and minimize the XAML to be that which is required for the feature in typical usage.
Steps to reproduce
Expected behavior
Proposal:
This would create a button on the side panel which when clicked would execute the method of the given sample class, in the above
TestMethod. It would also create a namedSendMessageCommandwhich could be leveraged in the sample XAML code for other purposes as well if some embedded UI element also needed a command version of it to trigger in an alternate way or ifisVisibleis set to false to use just as a command but not show in the sidebar.Don't think there's a better way to connect the method to the attribute... @Sergio0694? I suppose we could put the attribute on the method in the class instead? Would separate it from our other options, but make it clearer and remove the need for
nameof. Would also make it easier if we wanted to remove that method from the displayed sample code:Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
No response
Visual Studio Build Number
No response
Device form factor
No response
Additional context
No response
Help us help you
Yes, but only if others can assist.