Witam was,

Mam taki problem z designerem - stworzyłem sobie UserControl, który jest moim głównym menu. W nim są buttony, do których podłączony jest styl sprawiający, że button jest kwadratowy o szerokości takiej, jaką ma grid w którym się znajduje. Po odpaleniu programu wszystko wygląda tak jak powinno. Jest tylko jedna rzecz - w Designerze okno wygląda całkiem inaczej. Kod i obrazki:

W window.xaml

<Grid Name="mainGrid" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" MinWidth="120"/>
                <ColumnDefinition Width="8*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="6*"/>
            </Grid.RowDefinitions>


            <ScrollViewer Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"   >
                <Grid Name="majorButtonMenuGrid" Background="Plum" >
                    <local:UserControl1></local:UserControl1>
                </Grid>
            </ScrollViewer>

            <Grid Name="labelGrid" Grid.Row="0" Grid.ColumnSpan="2">
                <Label  MinHeight="30" HorizontalAlignment="Center" ></Label>
            </Grid>
            

            <Grid Name="minorButtonMenuGrid" Grid.Column="1" Grid.Row="1" Background="RosyBrown">
                
            </Grid>
            
            <Grid Name="contentGrid" Grid.Column="1" Grid.Row="2" Background="LightPink">
            </Grid>
            
        </Grid>

UserControl1.xaml

<UserControl x:Class="WPFProgramBananowy.UserControl1"
             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" 
             mc:Ignorable="d" 
             x:Name="User"
             d:DesignHeight="500" d:DesignWidth="130">

    <UserControl.Resources>
        <Style TargetType="Button" x:Key="SquareButton">
            <Setter Property="MinHeight" Value="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType=StackPanel, AncestorLevel=1}}" />
            <Setter Property="MinWidth" Value="{Binding ActualHeight, RelativeSource={RelativeSource Mode=Self}}" />
            <Setter Property="Margin" Value="0,0,0,10"/>
        </Style>
    </UserControl.Resources>
    
    <StackPanel Orientation="Vertical" Margin="10">
        <Button  Style="{StaticResource ResourceKey=SquareButton}"></Button> 
    </StackPanel>
</UserControl>
 

Wygląd w designerze dla 3 przycisków - ciemnoróżowy pasek zbyt wysoki
user image

Wygląd w designerze dla 5 przycisków - ciemnoróżowy pasek jeszcze się powiększył
user image

Wygląd w programie - tak jak to powinno wyglądać dla 5 przycisków
user image

Zmienia się wygląd minorButtonMenuGrid przez Buttony w UserControlu - dodanie większej ilości Buttonów skutkuje większym menu w Designerze, ale w programie wygląda to już tak jak powinno.