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.
![]()
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:
- a Path that draw the little corner as you can see it in the screenshot above;
- then a rectangle which is the little white “bulb” ;
- 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.
November 12th, 2008 at 11:44 am
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.
November 15th, 2008 at 10:56 am
Hi,
I will make another post where i willput also the columns.
December 2nd, 2008 at 8:11 am
Тема ну просто пиздец.
Неужели ничего поактуальней не нашлось?
December 4th, 2008 at 10:42 am
Hi Турок,
please write in english.
December 9th, 2008 at 5:36 pm
Many thanks for the great idea! I follow the blog, a lot of interesting things. My blog is about science, I hope, too, enjoy;)
January 23rd, 2009 at 12:01 am
[…] Recent public urls tagged “xaml” → WPF 2advanced ListView Style […]
February 3rd, 2009 at 1:10 am
Thank you very useful and informative article!
Material good, and certainly look forward to new articles
The author thanks
February 15th, 2009 at 11:30 am
In the current situation, most of those moving away to second place. I wonder how we will live, if the dollar collapses?
February 15th, 2009 at 2:15 pm
A lot of interesting things here!
Thank you very much.
February 18th, 2009 at 5:38 pm
We finally found something that I wanted to read it.
By the way, I have pictures on this topic. Where can I off?
February 19th, 2009 at 6:59 am
Thank you for your wonderful article. I have a picture of the topic where you can throw off?
February 23rd, 2009 at 4:10 am
Finally I found what i wanted to read.
February 27th, 2009 at 11:52 am
We finally found something that was looking for.
But comments are not immediately added * atoms, I wrote here and then look at all no
April 15th, 2009 at 2:49 am
I bookmarked this site, Thank you for good job!
May 11th, 2009 at 6:37 pm
Why do you need to use ListView here? Couldn’t you use ListBox or even just ItemsControl?
May 13th, 2009 at 8:22 am
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.
August 19th, 2009 at 8:32 pm
[…] - WPF 2advanced ListView Style saved by watchman552009-08-18 - 2advanced制作 | webデザイン saved by tukhubi2009-07-21 - […]