-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add .NET MAUI Controls Expert custom agent #718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
PureWeen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this is looking good
Can you explore every single control that you can use in .NET MAUI
https://github.com/dotnet/docs-maui/tree/main/docs/user-interface/controls
And include something about those controls that you think a maui expert would find useful
Added comprehensive coverage of every .NET MAUI control organized by category:
Each control includes usage guidance, XAML examples, and important tips like when to use CollectionView vs ListView, Border vs Frame, and proper image referencing. (2682cc5) |
|
@copilot add mention of using expression-based // DO:
label.SetBinding(Label.TextProperty, static (ViewModel vm) => vm.FullName?.FirstName);
var binding = Binding.Create(static (ViewModel vm) => vm.FullName?.FirstName);
// DO NOT:
label.SetBinding(Label.TextProperty, "FullName.FirstName");
var binding = new Binding("FullName.FirstName");Refer to https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/data-binding/compiled-bindings?view=net-maui-10.0#compiled-bindings-in-code for more information |
Added guidance on expression-based compiled bindings in C# code to the Data Binding Best Practices section. The agent now recommends using |
PureWeen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For scrollview and collectionview
Emphasize NEVER placing these controls inside any of the stacklayout controls
All the *stacklayout controls allow for infinite space so they will invalidate all the virtualization that happens with collectionview amd it will make scrollview not scroll
Added critical warnings for both ScrollView and CollectionView that they should NEVER be placed inside any StackLayout controls (StackLayout, HorizontalStackLayout, VerticalStackLayout). These layouts allow infinite space which breaks scrolling completely for ScrollView and invalidates virtualization for CollectionView. (0f96fe2) |
|
@copilot can you add these instructions? |
| 7. **Avoid Memory Leaks:** Unsubscribe from events, dispose of resources properly | ||
| 8. **Use Proper Controls:** Choose CollectionView over ListView, Grid over StackLayout, Border over Frame | ||
|
|
||
| **Profiling Tools:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathanpeppers would this be useful to include in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is this section wouldn't work for mobile, do you want to just link here instead:
| - Handlers are lightweight and directly map virtual views to native platform views | ||
| - Renderers are obsolete and should not be used in new code | ||
|
|
||
| **Customizing Controls with Handlers:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot suggest putting this code inside the configurehandler call on builder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the handler customization code to show it inside builder.ConfigureHandlers() call in MauiProgram.cs. (ce16c2b)
| - **⚠️ NEVER:** Use `BackgroundColor` if a `Background` property exists - always use `Background` instead | ||
| - `Background` supports solid colors, gradients, and brushes - use it for all background needs | ||
|
|
||
| ### Data Binding Best Practices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StephaneDelcroix any notes or additional changes you want to make to this file around bindings?
.github/agents/maui-expert.agent.md
Outdated
| </maps:Map.Pins> | ||
| </maps:Map> | ||
| ``` | ||
| **Setup Requirements:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove this section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the Map setup requirements section. (ce16c2b)
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
…sage Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
…ver BackgroundColor; warn about StackLayout with ScrollView/CollectionView Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
…ConfigureHandlers Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
ce16c2b to
847c94a
Compare
Creates a custom GitHub Copilot agent with deep expertise in .NET MAUI controls, their proper usage, performance optimization, and common pitfalls.
Agent Capabilities
Comprehensive Controls Reference (30+ controls)
Obsolete Controls (NEVER USE)
Control Selection Best Practices
Critical Layout Warnings
Data Binding Best Practices
x:DataType(8-20x improvement)SetBinding(property, static (ViewModel vm) => vm.Property)over string-basedSetBinding(property, "Property")Binding.Create(static (ViewModel vm) => vm.Property)overnew Binding("Property")Handler Customization
ConfigureHandlerscall on builder in MauiProgram.csMapper.AppendToMappingfor per-control customizationsPerformance Critical
Common Pitfalls
Platform-Specific
Configuration
Located at
.github/agents/maui-expert.agent.mdwith all tools enabled. Based on official Microsoft Learn documentation and control documentation from dotnet/docs-maui. Focused specifically on .NET MAUI controls expertise rather than general architecture patterns.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.