Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Office Themes

Sort Posts: Previous Next
  •  04-28-2008, 12:29 AM Post no. 11776

    Office Themes

    I'm new to the Xceed DataGrid WPF and was wondering if there is an easy way to apply the Office2007 Themes?  I found the Themes folder but I'm not sure if there is the "standard" Blue, Silver and Black available.  Is there sample code for the Office themes or do I need to generate it?

    Thanks

  •  04-28-2008, 8:50 AM Post no. 11782 in reply to 11776

    Re: Office Themes

    The Office themes are located in the ThemePack assemblies (Xceed.Wpf.DataGrid.ThemePack.[#].dll), which must be included in your references. You can then apply them to the grid by setting the View.Theme property using property element syntax:

    <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
      <Grid.Resources>
        <xcdg:DataGridCollectionViewSource x:Key="cvs_orders"
                                         Source="{Binding Source={x:Static Application.Current},
                                                          Path=Orders}"/>
      </Grid.Resources>
       <xcdg:DataGridControl x:Name="OrdersGrid"
                             ItemsSource="{Binding Source={StaticResource cvs_orders}}">

         <xcdg:DataGridControl.View>
            <xcdg:CardView>
               <xcdg:CardView.Theme>
                  <xcdg:Office2007BlueTheme/>
               </xcdg:CardView.Theme>
            </xcdg:CardView>
         </xcdg:DataGridControl.View>
       </xcdg:DataGridControl>
    </Grid>

    You can look in the documentation under Basic Concepts\Appearance\Views and Themes for a list of the theme names. Also note that the themes located in the theme packs require a Pro license key (either trial or registered).


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
    Filed under: ,
  •  06-11-2008, 4:38 PM Post no. 12881 in reply to 11782

    Re: Office Themes

    Can you tell me how to get something like this to work (or maybe it can't be done). I do have both themepacks referenced in the project.

    <Style TargetType="{x:Type xcdg:TableView}">

    <!--<Setter Property="Theme" Value="AeroNormalColorTheme"/>-->

    <Setter Property="Theme" Value="Office2007BlueTheme"/>

    </Style>

     

    The error I get:

    Cannot convert string 'Office2007BlueTheme' in attribute 'Theme' to object of type 'Xceed.Wpf.DataGrid.Views.Theme'. The specified theme is invalid.

    Parameter name: value Error at object 'System.Windows.Setter' in markup file 'Skins/DefaultSkin.xaml' Line 534 Position 34.

  •  06-12-2008, 7:40 AM Post no. 12894 in reply to 11776

    Re: Office Themes

    Hi there,

    I do that in code and let the user decide what theme he/she wants.  (Just make sure that you set your datagrid to a initial theme.)

     

            private void ComboBox_Theme_Selector_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                if (ComboBox_Theme_Selector.SelectedIndex == 0)
                {
                    dgc1.View.Theme = null;
                }

                if (ComboBox_Theme_Selector.SelectedIndex == 1)
                {
                    dgc1.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.WMP11Theme();
                }
                if (ComboBox_Theme_Selector.SelectedIndex == 2) 
                {
                    dgc1.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.GlassTheme();
                }

                if (ComboBox_Theme_Selector.SelectedIndex == 3) 
                {
                    dgc1.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.Office2007BlackTheme();
                }

                if (ComboBox_Theme_Selector.SelectedIndex == 4) 
                {
                    dgc1.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.Office2007BlueTheme();
                }

                if (ComboBox_Theme_Selector.SelectedIndex == 5) 
                {
                    dgc1.View.Theme = new Xceed.Wpf.DataGrid.ThemePack.Office2007SilverTheme();
                }
               

               
            }

  •  06-12-2008, 8:08 AM Post no. 12898 in reply to 12881

    Re: Office Themes

    Appropriate syntax is:

    <Style TargetType="{x:Type xcdg:TableView}">
        <Setter Property="Theme">
            <Setter.Value>
                <xcdg:Office2007BlueTheme/>
            </Setter.Value>
        </Setter>
    </Style>

    This is because the ThemeConverter class that does the default string-to-theme conversion is located in the main DataGrid assembly and we did not wanted to add dependencies on the ThemePacks to the DataGrid assembly.
     

     



    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.