开发者

Curve the border of silverlight listbox control

Curve the border of silverlight listbox control:

I just want to curve the ends of the silverlight listbox border.

Is there any thing wrong I am doing , because i am not able to get the borders curve :

  <Style TargetType="ListBox" x:Key="listboxStyle">
    <Setter Property="Padding" Value="1"/>
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="VerticalContentAlignment" Value="Top" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="TabNavigation" Value="Once" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="ListBox">
          <Grid Background="White">
              <Border Background="White" BorderThickness="0" CornerRadius="10">
                <ScrollViewer Background="White" x:Name="ScrollViewerElement" Padding="{TemplateBinding Padding}">
                  <ItemsPresenter />
                </ScrollViewer>
              </Border>
          </Grid>
        </ControlTemplate>
      &l开发者_C百科t;/Setter.Value>
    </Setter>
  </Style>


Ok I got it done and there was no need to style the listbox control .

    <Border BorderBrush="White" BorderThickness="0" CornerRadius="5" Background="White" >
       <ListBox x:Name="lstEnities" BorderThickness="0" Margin="5" Grid.Row="0"></ListBox>
    </Border>


Please check on how to edit the control template of a ListBox(or any WPF control) - http://msdn.microsoft.com/en-us/library/ms754242.aspx You can give CornerRadius on the Border inside the controltemplate.


Check this section Minimally templated ListBox and ListBoxItem with Template and ControlTemplate:

of that blogpost

http://blogs.msdn.com/delay/archive/2008/03/05/lb-sv-faq-examples-notes-tips-and-more-for-silverlight-2-beta-1-s-listbox-and-scrollviewer-controls.aspx

The author of the blog is the writer of the listbox control (as I remember).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜