DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone >

How to Re Style the AvalonControlsLibrary DataGridView

Marlon Grech user avatar by
Marlon Grech
·
Mar. 17, 09 · · News
Like (0)
Save
Tweet
2.63K Views

Join the DZone community and get the full member experience.

Join For Free

i received an email from 3 different persons asking me how to restyle the column headers of the datagridview control of avaloncontrolslibrary so i decided to put a small blog post for it.

let’s start from here… the avaloncontrolslibrary is just a listview (with a gridview as view) that creates it’s gridviewcolumns dynamically on runtime by looking at the properties(and their metadata) of the bound object. so how can you control the look of the columns if they are being generated dynamically? well here we can use the power of wpf’s styling system. we can create a style in a resourcedictionary that does not have the x:key set but only the targettype. by doing so we will be setting the style to all our gridviewcolumns.

an example for this is setting a style for the headers. here is the xaml to do so

<grid>
<grid.resources>
<style targettype="{x:type gridviewcolumnheader}">
<setter property="template">
<setter.value>
<controltemplate targettype="{x:type gridviewcolumnheader}">
<border cornerradius="5" borderbrush="yellow" borderthickness="2">
<contentpresenter />
</border>
</controltemplate>
</setter.value>
</setter>
</style>
</grid.resources>

<controls:datagridview itemssource="{binding}" />
</grid>

hope this helps :)

p.s for anyone using the datagridview i would suggest to have a look at the new datagrid control from microsoft . it’s really really cool!

Column (database) IT POST (HTTP) Metadata Blog Object (computer science)

Published at DZone with permission of Marlon Grech. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Use Lambda Function URL To Write a Serverless App Backed by DynamoDB
  • Why Is Software Integration Important for Business?
  • A Simple Guide to Heaps, Stacks, References, and Values in JavaScript
  • How Database B-Tree Indexing Works

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo