Share via

WPF CustomBinding

xin yong liu 0 Reputation points
2023-08-08T15:15:36.9733333+00:00

I hope that the binding effect is similar to this Margin="0,0,0, binding parent label", but unfortunately the Bottom of Thickness is not a dependency property.

I want to customize the binding and then intercept the obtained Thickness and make some modifications during the process of binding and passing values.

I browsed a lot of documents but still don't understand the principle (maybe I'm stupid).

        <local:Card Height="100" Width="100" CornerRadius="7" 
                    BorderBrush="Black" BorderThickness="2">
            <local:Card Background="#E6D9A5" 
                        CornerRadius="7,7,0,0" 
                        BorderThickness="{local:ThicknessBinding Path=BorderThickness Side=Bottom}"
                        BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type local:Card}}}">
                <TextBlock Text="Hello" Margin="10,0,0,0"/>
            </local:Card>
        ```

Developer technologies | XAML
Developer technologies | XAML

A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.

0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.