Closed ScottSEA closed 12 months ago
Thanks for the PR!! I'm not sure how this will be received since it's Xamarin only. It's probably not the main use case for .XAML files in VS. There might not be one at all. For instance, for WPF how would we even know if the user wants a Window or UserControl ?
The more I think about it, the more I think it should just be an empty XML file with a <?xml version="1.0" encoding="UTF-8"?>
declaration and the xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
namespace. Maybe put the cursor $
as the empty first element?
@madskristensen can VS's file templates be accessed from the extension? Would it be possible to cache those per-file extension, maybe, and then build a simplified version of the picker:
.xaml
is clearly a big one, but it's also true of .cs
— you can pick, say, interface vs. class), show a picker. Use up/down arrow keys to navigate these.So, for example, once you're down typing Controllers/InvoiceController.cs
, you can use up/down to pick between class, interface, struct.
*) perhaps with the addition of a label that shows which template would be used.
Is it possible to add different xaml flavours based on the project you're adding the file to ? ie, use a different template based on project type ?
XAML template for Xamarin Forms developers - admittedly biased despite WPF or UWP using XAML as well.