开发者

Silverlight 3 DataGrid - Rounded Corners

Is there an ea开发者_JAVA技巧sy way to give rounded corners to the boundary of a DataGrid in Silverlight 3?

Thanks a bunch!


I just answered a similar question here for giving rounded corners to any FrameworkElement by attaching a Blend clipping behavior with a specified CornerRadius.

You could write your own logic for the clipping behavior or use the one from the Expression Blend Samples CodePlex page. It would then be as simple referencing System.Windows.Interactivity.dll from the Blend SDK and dropping the behavior on the element in Blend or writing out the XAML:

<data:DataGrid>
    <i:Interaction.Behaviors>
        <samples:ClippingBehavior CornerRadius="15"/>
    </i:Interaction.Behaviors>
</data:DataGrid>

Its a nice reusable way to give rounded corners to any element without relying on a border or an element with corner radii properties.


<Border.Background>
  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
     <GradientStop Color="Black" Offset="0"/>
     <GradientStop Color="#FF508EB1" Offset="1"/>
  </LinearGradientBrush>
</Border.Background>

<Grid Background="{x:Null}"  x:Name="MainGrid" >
<Grid.Effect>
  <DropShadowEffect />
</Grid.Effect>

    <...>
</Grid>
</Border>


<Border CornerRadius="5">
    <toolkit:DataGrid />
</Border>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜