Silverlight 4 Border Clipping

Is it possible in Silverlight 4 to create a rounded border that grips any of them with a child UI? So far I have tried to do this by setting the button as a child of the border control, but the buttons are not cropped when I set the corner radius to create rounded corners on the border.

+4
source share
1 answer

Take a look at ClippingBehavior , which is part of the Expression Blend samples on CodePlex. This is the Blend behavior, so to add it you need to refer to the System.Windows.Interactivity.dll from the Blend SDK and drop the element's behavior in Blend or add it to XAML:

<UserControl x:Class="MyApplication.MainPage" ...other xmlns imports... xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:samples="clr-namespace:Expression.Samples.Interactivity;assembly=Expression.Samples.Interactivity" > <Border> <i:Interaction.Behaviors> <samples:ClippingBehavior CornerRadius="15"/> </i:Interaction.Behaviors> <!-- content to be clipped goes here --> </Border> </UserControl> 

This is a simple and reusable way to add rounded corners / crop to any user interface element.

+4
source

All Articles