WPF DataGrid style-Silverlight DataGrid?

14,075

Solution 1

I haven't found any projects with a working Silverlight-style DataGrid, so I created one on Codeplex:

http://datagridthemesfromsl.codeplex.com

Doesn't have all the themes, but there's at least a few there.

Solution 2

Buried deep within MSDN, I found this.

Toward the bottom of the article, you will see this phrase:

For example, take a look at the following illustration that shows part of the Styling with ControlTemplates Sample

If you click 'Styling with ControlTemplates Sample', it will take you to a download link. After download, you can compile the project and it includes all kinds of styles, including the elusive datagrid style! You can take MS's DataGrid.xaml file and modify it for your needs.

Solution 3

Seems there is not out-the-box style.
I posted a suggestion to Microsoft suggestions site, please vote here and here!!!

Anyone who has mimicked the Silverlight DataGrid default style to WPF should please post his answer and I will mark it as answer and give him a vote!

Thanks a lot!

Solution 4

WPF ships with a number of styles such as Luna, Aero, Classic, etc. These themes are applied based on your system settings. The screenshot from the previous post looks like the WPF Classic theme, but I'm guessing you're looking for a more appealing theme.

If you’re using a Classic system theme on your OS but would like your WPF application to use the Aero theme for example, you can add a merged dictionary to your app and force the Aero theme as shown below. Please note that you may need to change the binary version and public key accordingly.

<Application.Resources>
   <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
         <ResourceDictionary
             Source="/PresentationFramework.Aero;V4.0.0.0;31bf3856ad364e35;component\themes/aero.normalcolor.xaml"/>
      </ResourceDictionary.MergedDictionaries>
   </ResourceDictionary>
</Application.Resources>

Hope that helps, Saied K.

Share:
14,075
Shimmy Weitzhandler
Author by

Shimmy Weitzhandler

Updated on June 03, 2022

Comments

  • Shimmy Weitzhandler
    Shimmy Weitzhandler almost 2 years

    That's not a secret: Silverlight's DataGrid default style is beautiful while WPF's is poor.

    Instead of reinventing the wheel let me ask the community if anyone has copied the SL styles to use in WPF.

    Please take a look at the screenshots and judge for yourself how the Silverlight and WPF teams invest in their products.

    Silverlight default-style DataGrid:

    Silverlight DataGrid

    WPF default-style DataGrid (updated after Saied K's answer):
    WPF DataGrid

  • Shimmy Weitzhandler
    Shimmy Weitzhandler over 14 years
    I saw it, thanks, I hope someone of the lazy employees overthere is going to see it.
  • Shimmy Weitzhandler
    Shimmy Weitzhandler over 14 years
    I opened a new one, I think once they close a connection, no alerts are received for further comments, please look connect.microsoft.com/WPF/feedback/….
  • devuxer
    devuxer over 14 years
    +1 for that one too. BTW, one thing that does help a little bit for is to turn the grilines off using GridLinesVisibility="None". It still won't be as pretty as the Silverlight version, but those black gridlines are soooo ugly.
  • Shimmy Weitzhandler
    Shimmy Weitzhandler over 13 years
    I updated my photo, in the new photo you can see the wpf DataGrid's default style in a Windows 7 Aero theme environment, you can clearly see it on the window frame. With all due respect, you really didn't understood my question.
  • Shimmy Weitzhandler
    Shimmy Weitzhandler over 13 years
    Of course, we updated to 4.0 long ago, but .NET 4 didn't make any improvemnt in WPF style.
  • gideon
    gideon about 13 years
    +1 thanks very much! Could you elaborate on your codeplex page how to use it with an existing data grid?
  • SliverNinja - MSFT
    SliverNinja - MSFT over 12 years
    +1 Was looking for the WPF SimpleStyles project that contained all the basic control templates for WPF. Thanks for the help!
  • SliverNinja - MSFT
    SliverNinja - MSFT over 12 years
    @gideon - the link is now available.
  • Shimmy Weitzhandler
    Shimmy Weitzhandler about 12 years
    @Matt, did you test this theme and it affects the DataGrid control as well?
  • devuxer
    devuxer about 12 years
    I gave it the only two votes I had left. (I hate that there are only 10 votes total...)
  • Shimmy Weitzhandler
    Shimmy Weitzhandler about 12 years
    Please vote here and here and leave rude comments!
  • Rachel
    Rachel over 11 years
    @Shimmy Are there different ResourceDictionaries with this sample app, please? I've only found Shared.xaml, and the skin is blue and really ugly when compared to the silver one shown on MSDN. Is this silver template also available for download?