I
I
Ivan2020-03-01 03:40:58
WPF
Ivan, 2020-03-01 03:40:58

I can not understand where the inscription on the form comes from, the text of the inscription is the same as on the button. Where is the mistake?

XAML code

<Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <Border BorderThickness="3"
                                    BorderBrush="Green"
                                    Width="100"
                                    Height="50"
                                    Background="Pink"
                                    CornerRadius="14"/>
                            <ContentPresenter HorizontalAlignment="Center"
                                              VerticalAlignment="Center"/>
                            <ContentControl Content="{TemplateBinding Content}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <StackPanel>
        <Button Content="knopka"/>
    </StackPanel>
5e5b0495e5c07636705097.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2020-03-01
@Vamba45

I think it's the ContentControl. Most likely it displays an inscription, look at how the standard button template is made.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question