WPF 2advanced ListView Style

Hi,

Sorry for not posting earlier anything yet, but i have been busy so i decided to start a series in which i will try to create all the controls you can see in the site www.2advanced.com and first i started with the ListView control and styled it like the one you can see in the site.

In the below image you can see more details.

Img 2advanced
So the only things that i styled here was the ListView and The ListViewItem.

ListView:

The template of the listview is very simple it has a border and in that border the default contentpresenters of the listview:

<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="4">

     <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">

          <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

     </ScrollViewer>

</Border>

ListViewItem:

This control is a little bit complicated but not too much. So first is COntrolTemplate that it’s just a grid with 3 columns:

  1. a Path that draw the little corner as you can see it in the screenshot above;
  2. then a rectangle which is the little white “bulb” ;
  3. an finally the ContentPresenter;
<Grid><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Path Margin="6,0,0,0" SnapsToDevicePixels="true" Grid.Column="0" x:Name="Path" Width="6" Height="5" Stretch="Fill" StrokeThickness="1" StrokeMiterLimit="2.75" Stroke="{TemplateBinding BorderBrush}" Data="F1 M 0,0L 0,5L 6,5"/>
<Rectangle Margin="6,0" x:Name="whiteSquare" SnapsToDevicePixels="true" Grid.Column="1" Fill="#FFFFFF" Width="3" Height="7">
<Rectangle.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="#ffffff" GlowSize="0" Opacity="1"/>
</Rectangle.BitmapEffect>
</Rectangle>
<ContentPresenter Grid.Column="2" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>

To make the animation on the trigger IsMouseOver i start and stop 2 storyboards.

<Trigger Property="IsMouseOver" Value="True"><Trigger.EnterActions><BeginStoryboard Storyboard="{StaticResource FadeIn}"/></Trigger.EnterActions>

<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource FadeOut}"/>
</Trigger.ExitActions>
</Trigger>

To see the code for the storyboards download the whole project from here.

For the next post i will make the nice slick ScrollBar.

17 Responses

  1. Nelson Says:

    I am intend to use the listview control to display more than one column and I would like the listview header to be displayed as well. May I know how should I change the template? Thanks.

  2. admin Says:

    Hi,
    I will make another post where i willput also the columns.

  3. Турок Says:

    Тема ну просто пиздец.
    Неужели ничего поактуальней не нашлось?

  4. admin Says:

    Hi Турок,

    please write in english.

  5. Olechka-persik Says:

    Many thanks for the great idea! I follow the blog, a lot of interesting things. My blog is about science, I hope, too, enjoy;)

  6. Recent URLs tagged Xaml - Urlrecorder Says:

    […] Recent public urls tagged “xaml” → WPF 2advanced ListView Style […]

  7. natasenka Says:

    Thank you very useful and informative article!
    Material good, and certainly look forward to new articles :)
    The author thanks

  8. zanussi Says:

    In the current situation, most of those moving away to second place. I wonder how we will live, if the dollar collapses?

  9. Москвич Says:

    A lot of interesting things here!
    Thank you very much.

  10. Питерец Says:

    We finally found something that I wanted to read it.
    By the way, I have pictures on this topic. Where can I off?

  11. Валентина Says:

    Thank you for your wonderful article. I have a picture of the topic where you can throw off?

  12. Наталья Says:

    Finally I found what i wanted to read.

  13. Marinochka Says:

    We finally found something that was looking for.
    But comments are not immediately added * atoms, I wrote here and then look at all no

  14. mark Says:

    I bookmarked this site, Thank you for good job!

  15. Drew Noakes Says:

    Why do you need to use ListView here? Couldn’t you use ListBox or even just ItemsControl?

  16. admin Says:

    Yes, I could have used ListBox, but I was tired when I’ve made this post initially I wanted to make it as a ListBox, but by mistake I made it as a Listview.

  17. Websites tagged "2advanced" on Postsaver Says:

    […] - WPF 2advanced ListView Style saved by watchman552009-08-18 - 2advanced制作 | webデザイン saved by tukhubi2009-07-21 - […]

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.