Home Forums WPF controls Xceed Toolkit Plus for WPF Different Accent color

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • obiben
    Participant
    Post count: 20
    #44480 |

    Hi there,

    It seems like I can choose whatever color I want as an accent from code-behind for datagrids, like so:

    datagrid.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.MetroTheme(new Xceed.Wpf.DataGrid.ThemePack.MetroDarkThemeResourceDictionary(new SolidColorBrush(Color.FromRgb(60, 60, 60))));

    But I can’t go:

    <Color x:Key="AccentColor" A="255"  R="60" G="60" B="60" />
    <SolidColorBrush x:Key="AccentBrush" Color="{StaticResource AccentColor}" />
    <xcpt:MetroDarkThemeResourceDictionary
                        AccentColor="{StaticResource AccentBrush}"
                        LicenseKey="XXXXXXXXXXXXXXXXXXXXXXXXXX"/>

    As the valid colors come from an Enum. Why is that? Is there a way to add my own accent colors? Is it possible to put in a request for accents to just be plain old Color objects instead?

    Fawzi [Xceed]
    Moderator
    Post count: 659

    Hi,

    1) When using the DataGrid from the Toolkit :
    a) you can set the Metro theme in code-behind this way:

    _dataGrid.View.Theme = new Xceed.Wpf.DataGrid.Themes.Metro.MetroTheme( new Xceed.Wpf.DataGrid.Themes.Metro.MetroDarkThemeResourceDictionary( new SolidColorBrush( Color.FromRgb( 255, 0, 0 ) ) ) );

    b) you can set the Metro theme in XAML this way:

    <Window.Resources>
    <Color x:Key=”AccentColor”
    A=”255″
    R=”255″
    G=”0″
    B=”0″ />
    <SolidColorBrush x:Key=”AccentBrush”
    Color=”{StaticResource AccentColor}” />
    <xclt:MetroDarkThemeResourceDictionary x:Key=”MyTheme”
    AccentBrush=”{StaticResource AccentBrush}” />

    </Window.Resources>

    <Grid>
    <xcdg:DataGridControl x:Name=”_dataGrid”>
    <xcdg:DataGridControl.View>
    <xcdg:TableflowView>
    <xcdg:TableflowView.Theme>
    <xclt:MetroTheme ThemeResourceDictionary=”{StaticResource MyTheme}” />
    </xcdg:TableflowView.Theme>
    </xcdg:TableflowView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>
    </Grid>

    2) When using the Full DataGrid:
    a) you can set the Metro theme in code-behind this way:

    _dataGrid.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.MetroTheme( new Xceed.Wpf.DataGrid.ThemePack.MetroDarkThemeResourceDictionary( new SolidColorBrush( Color.FromRgb( 255, 0, 0 ) ) ) );

    b) you can set the Metro theme in XAML this way:

    <Window.Resources>
    <Color x:Key=”AccentColor”
    A=”255″
    R=”255″
    G=”0″
    B=”0″ />
    <SolidColorBrush x:Key=”AccentBrush”
    Color=”{StaticResource AccentColor}” />
    <xcdg:MetroDarkThemeResourceDictionary x:Key=”MyTheme”
    AccentBrush=”{StaticResource AccentBrush}” />

    </Window.Resources>

    <Grid>
    <xcdg:DataGridControl x:Name=”_dataGrid”>
    <xcdg:DataGridControl.View>
    <xcdg:TableflowView>
    <xcdg:TableflowView.Theme>
    <xcdg:MetroTheme ThemeResourceDictionary=”{StaticResource MyTheme}” />
    </xcdg:TableflowView.Theme>
    </xcdg:TableflowView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>
    </Grid>

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.