Continue with WPF-use Blend to customize the list header of the Listview Control

Source: Internet
Author: User

Right-click the ListView control in Blend. From the menu items related to the style and template, the items related to the list header are not found.

 

Then, go to the properties panel to find the ColumnHeaderContainerStyle attribute of the GridView. As a result, even if you convert it to a local resource in the advanced options menu, you will find that it does not respond, the generated code is not displayed when you switch to the XAML view.

 

Is there no way? I was wondering if I could only write the XAML? You actually need to write a little code manually, but you can use it with the Blend designer. How can this problem be solved? Switch to the XAML view and add a style in the Window resource to point to the style of GridViewColumnHeader:

<Span style = "font-size: 16px;"> <Style TargetType = "{x: Type GridViewColumnHeader}"/>
</Span>
Switch back to the design view and expand the "resource" panel.

 

Click to edit the resource,

Haha, this is the case. Change the background first. The default theme of the system is too ugly.

 

Now, it looks better.

 

 

However, we found that the following border is not very beautiful, so we need to edit the template.

On the "object and timeline" Panel, right-click the Style and choose "Edit template"> "edit copy" from the shortcut menu. Enter the Template Name and click OK.

 

 

 

Select the Border Control named "HightlightBorder" and change its appearance.

 

 

 

Next, you will beautify your own aesthetics. Finally, we will return to the Style and set the trigger.

On the "Trigger" Panel, click "+ properties" and select IsPressed from the list.

 

At this time, the record has started and the background color is modified.

 

 

Complete the IsMouseOver trigger in the same way.

 

Okay. Now, run it to see if the current ListView is much more beautiful than the default one.

 



From the column tcjiaan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.