Saturday 11 May 2013

DataGrid style for MahApps.Metro - Update

I've been making some updates to my DataGrid style to make it more like the DataGrid in Windows Azure.

MahApps.Metro DataGrid Style

Check out the pull request to MahApps.Metro or my branch on GitHub.

4 comments:

  1. Hi Dave,
    I like your DataGrid style for MahApps.Metro.
    I'm using MahApps.Metro version 0.12.1.0 installed via NuGet.
    Can you please explain how I can use your version?

    ReplyDelete
  2. Hi Bart,

    This style got accepted into MahApps.Metro, so you just need to enable it. In the file where you are including Controls.xaml from MahApps.Metro (likely your App.xaml or MainWindow.xaml), you need to add the following to your resources if you want every DataGrid to have that style:

    <Style TargetType="DataGrid" BasedOn="{StaticResource AzureDataGrid}" />

    or just manually set the style on each DataGrid as required (as in the MetroDemo example here: https://github.com/MahApps/MahApps.Metro/blob/master/samples/MetroDemo/MainWindow.xaml#L1158)

    I hope this helps.

    ReplyDelete
  3. Hi Bart and Dave,
    I am doing the same thing but the styles do not apply for some reason. I am getting a completely white grid without any colors or effects. Could you please suggest what am I missing. I downloaded mahapps from nuget with -pre argument for pre-release version.

    ReplyDelete
  4. Hi, sorry, not sure what it could be without seeing your code. I suggest you check out the official documentation here:

    http://mahapps.com/controls/datagrid.html

    You can also check the sample app code on github:

    https://github.com/MahApps/MahApps.Metro/tree/master/samples/MetroDemo

    ReplyDelete