AddAnyFile icon indicating copy to clipboard operation
AddAnyFile copied to clipboard

Added a XAML template

Open ScottSEA opened this issue 5 years ago • 4 comments

XAML template for Xamarin Forms developers - admittedly biased despite WPF or UWP using XAML as well.

ScottSEA avatar Dec 20 '20 03:12 ScottSEA

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 ?

madskristensen avatar Dec 23 '20 15:12 madskristensen

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?

ScottSEA avatar Dec 24 '20 04:12 ScottSEA

@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:

  • for folders, just leave the UI as is
  • for files where, given the extension, one VS template exists, leave the UI as is*
  • for files where multiple templates exist (.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.

chucker avatar Dec 25 '20 21:12 chucker

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 ?

insomniachi avatar Jun 14 '22 06:06 insomniachi