Answer the question
In order to leave comments, you need to log in
Why aren't sizes from styles applied to elements in a StackPanel?
Hello, I've run into a problem with the app.
I have styles with predefined sizes:
<Style x:Key="comboBox"
TargetType="ComboBox">
<Setter Property="Control.MinHeight"
Value="15" />
<Setter Property="Control.MaxHeight"
Value="25" />
<Setter Property="Control.MinWidth"
Value="100" />
<Setter Property="Control.MaxWidth"
Value="250" />
</Style>
<Style x:Key="textBox"
TargetType="TextBox">
<Setter Property="Control.MinHeight"
Value="15" />
<Setter Property="Control.MaxHeight"
Value="25" />
<Setter Property="Control.VerticalContentAlignment" Value="Center"/>
</Style>
<StackPanel Grid.ColumnSpan="2"
VerticalAlignment="Center"
Orientation="Horizontal"
Margin="0 0 0 5">
<StackPanel Margin="0 0 10 0">
<TextBlock Text="Тип документа"
Margin="0 0 0 2" />
<ComboBox Style="{StaticResource ResourceKey=comboBox}"/>
</StackPanel>
<StackPanel>
<TextBlock Text="Категория документа"
Margin="0 0 0 2"/>
<ComboBox Style="{StaticResource ResourceKey=comboBox}"/>
</StackPanel>
</StackPanel>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question