Use camelCasing for XML namespace prefixes
I have a Silverlight 3 project and I am using Visual Studio 2008 with R# 5.0.1517.12 installed. I have the following XAML:
<navigation:Page x:Class="FinancialApps.Client.Views.PublicationManager.PublicationManagerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="PublicationManagerPage Page">
<Grid x:Name="LayoutRoot">
<TableTypesUC
</Grid>
</navigation:Page>
The xml namespace prefix for the TableTypesUC User Control that ReSharper adds uses PascalCasing for the prefix of the XML namespaces as shown here:
<navigation:Page x:Class="FinancialApps.Client.Views.PublicationManager.PublicationManagerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:PublicationManager="clr-namespace:FinancialApps.Client.Views.PublicationManager" d:DesignWidth="640" d:DesignHeight="480"
Title="PublicationManagerPage Page">
<Grid x:Name="LayoutRoot">
<PublicationManager:TableTypesUC
</Grid>
</navigation:Page>
Is it possible to change this in the Options? I can't seem to find it.
Please sign in to leave a comment.
No, there is no such an option.
Can we get such an option or default to camelCasing?
Hello,
ReSharper currently uses upper camel casing as derived from CLR naming rules
for namespaces. If we rather follow XML naming rules then it should be all-lowercase,
possibly dash-separated. It's unclear which exactly convention is used by
standard XAML aliases because they'd usually have just one word or even a
hand-coded abbreviation.
Ideally, the namespace alias should be an abbreviation, something like "pub",
as a human would choose, but I doubt these can be derived from the namespace
name automatically. <publication-manager:TableTypesUC /> seems most consistent.
Are there any indications for using lower camel case? They don't seem to
be coming from XML or CLR namespaces.
—
Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”
It's just that I saw that all the prefixes have lower cases so it is just to be consistent. This is off course not a big issue but I was thinking that if it is a small thing to change, why not?