方向プロパティを持つ UserControl を作成しました。すべての方向付け作業は内部スタック パネルで行う必要があるため、プロパティにバインドしました。
これは実行時に問題なく動作しますが、WPF デザイナーは方向プロパティの既定値 ( horizontal ) ではなく、スタック パネルの既定値 ( vertical ) を表示します。
簡単な例を次に示します。XAML:
<UserControl x:Class="MyWpf.MyUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:MyWpf="clr-namespace:MyWpf"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <StackPanel Orientation="{Binding Path=Orientation, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type MyWpf:MyUserControl}}}">
        <TextBlock>A</TextBlock>
        <TextBlock>B</TextBlock>
        <TextBlock>C</TextBlock>
    </StackPanel>
</UserControl>
コードビハインド:
public partial class MyUserControl : UserControl
{
    public static readonly DependencyProperty OrientationProperty;
    static MyUserControl()
    {
        OrientationProperty = DependencyProperty.Register( "Orientation", typeof( Orientation ), typeof( MyUserControl ), new FrameworkPropertyMetadata( Orientation.Horizontal ) );
    }
    public Orientation Orientation
    {
        get
        {
            return (Orientation)GetValue( OrientationProperty );
        }
        set
        {
            SetValue( OrientationProperty, value );
        }
    }
    public MyUserControl()
    {
        InitializeComponent();
    }
}
私が見る唯一の解決策は、Orientation を ViewModel に含める (そして DesignData を使用する) ことですが、きれいにしたいのです。DesignData のようなものがあることを願っていますが、コントロール自体のためです。