可能であれば、使用するC#名前空間をWPF名前空間から分離することをお勧めします。これにより、あなたが持っている輸入数も減らすことができます。これはXmlnsDefinitionクラスのおかげでできます。あなたのライブラリのAssemblyInfo.csで
<Window x:Class="test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:test="http://whatever.com/test">
、あなただけ追加する必要があります。
[assembly: XmlnsDefinition("http://whatever.com/test", "test")]
[assembly: XmlnsDefinition("http://whatever.com/test", "test.Converters")]
[assembly: XmlnsDefinition("http://whatever.com/test", "test.Validators")]
[assembly: XmlnsDefinition("http://whatever.com/test", "test.CustomControls")]
注意これが唯一のあなたが一つに異なるアセンブリ内のクラスがある場合に動作することそれらを参照してください。同じアセンブリ内では、C#名前空間を使用する必要があります。
あなたも、WPFのXML名前空間にあなたの名前空間を追加することによって、完全に輸入を排除することができます。人々は書くことができます
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "test")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "test.Converters")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "test.Validators")]
を:あなたとあなたのチームが好きな
<Window x:Class="test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!-- Note: no namespace prefix needed! -->
<YourCustomControl />
。それは単なるローカルエイリアスです。 –
私はC#の初心者ですから、人はいつも何を選んでいますか? :-o – emesx
個人的に、私は階層を作成しません。そこには 'test'、' Converters'、 'Validators'があります。しかし、もう一度、 "何が効いていても"以外の規則はありません。 –