V
V
VM-032022-04-14 13:25:58
WPF
VM-03, 2022-04-14 13:25:58

How to style all the buttons that are in the StackPanel?

Actually the question is in the title. I have a nested Button in a StackPanel, I want styles to be applied to all these Buttons. The analog in css is .SomeClass > Button

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sumor, 2022-04-14
@VM-03

In the StackPanel resources, describe the style of the button.

<StackPanel>
<StackPanel.Resources>
       <Style TargetType="Button">
            <Setter Property="Width" Value="120"/>
            <Setter Property="Height" Value="30"/>
        </Style>
</StackPanel.Resources>
<Button />
<Button />
<Button />
</StackPanel>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question