0

I made a round window with Border like this:

<Border CornerRadius="{Binding WindowCornerRadius}" Background="{StaticResource BackgroundDarkBrush}">
    <Border.Effect>
        <DropShadowEffect ShadowDepth="0" Opacity="0.2"></DropShadowEffect>
    </Border.Effect>
</Border>
<Grid>
    <Grid.RowDefinitions>
        <!--Title Bar-->
        <RowDefinition Height="{Binding TitleHeightGridLength}"></RowDefinition>
        <RowDefinition Height="auto"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>
    <!--Title Bar-->
    <Border Background="{StaticResource TitleBrush}" CornerRadius="{Binding WindowCornerRadius,WindowCornerRadius,0,0}">
        <Grid Grid.Column="0" Panel.ZIndex="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Button Style="{StaticResource SystemIconButton}" Command="{Binding MenuCommand}">
                <Image Source="Images/Logo/Wink.png"></Image>
            </Button>
        </Grid>
    </Border>
</Grid>
</Grid>
</Border>

As you see I changed Background of first GridRow and this prevents it to be round(To have corner radius) and I would like to correct it adding border to first GridRow But I failed. The code above gives me error in CornerRadius="{Binding WindowCornerRadius,WindowCornerRadius,0,0}" :

No constructor for type "Binding" has 4 arguments.

My question is am I doing it correct by adding another border? (If yes how can I Bind CornerRadius individually).

1 Answers1

0

You cannot use a binding like this. A binding on CornerRadius will look for a Thickness-typed property from your DataContext, with the Path given inside the binding. The path is implicit in a binding, but you can set it explicitely : Property="{Binding Path=blabla}". More info here.

Does the CornerRadius dynamically change? Why?

Also have a look at this : Binding only part of the margin property of WPF control

FatalJamòn
  • 386
  • 2
  • 10