This project has moved and is read-only. For the latest updates, please go here.

PropertyGrid ComboBox and Office themes

Mar 8, 2013 at 10:02 AM
Is there a problem with the ComboBoxItem template/style, or is it me? I find that, with a custom ItemsSource and one of the Office 2007 themes (BureauBlue), that the items in the combo don't get rendered and just show as "Xceed.Wpf.Toolkit.PropertyGrid.Attributes.Item". Without this or any theme, all is fine - you see the strings in the drop-down as expected.

My workaround was to put a key on the ComboBoxItem style in the theme, but this will affect all combo boxes in the application, of course, and I lose the theme style in the Propertygrid combos. As it happens, I don't have many other combos anyway, and those that I have are heavily customised already.

But, is there a better solution? I would prefer to alter/define a style for the Xceed...Attributes.Item, but all attempts have failed so far.

Thanks

James.
Mar 8, 2013 at 5:35 PM
The behavior on my side was working properly by modifying the "CustomItemsSource.xaml" file from the "Providing an ItemsSource" sample:
<sample:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomItemsSource"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:sample="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
                 xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                 xmlns:xctt="http://schemas.xceed.com/wpf/xaml/toolkit/themes"
                 xmlns:xcpt="http://schemas.xceed.com/wpf/xaml/themes"
                 Title="Custom ItemsSource"
                 Description="Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property.  The PropertyGrid supports this scenario by create a class that implements IItemsSource and decorating your property with the ItemsSourceAttribute.">
   <StackPanel Margin="10">
      <StackPanel.Resources>
         <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
               <xctt:Office2007BlueResourceDictionary StyleUsageMode="Implicit" />
               <xcpt:Office2007BlueResourceDictionary StyleUsageMode="Implicit"/>
            </ResourceDictionary.MergedDictionaries>
         </ResourceDictionary>
      </StackPanel.Resources>
      <TextBlock Text="Providing a Custom ItemsSource:" Style="{StaticResource Header}" />
      <TextBlock Text="This example uses a collection of Doubles to represent the available options for the WritingFontSize property." TextWrapping="Wrap" />
      <xctk:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
   </StackPanel>
</sample:DemoView>
Since you seems to be a "Plus" edition subscriber (or trial) I would recommend to contact our support team with a sample app that reproduce your problem so we can help you out.
Mar 11, 2013 at 8:33 AM
Thanks for your prompt reply. Unfortunately I am using the freeware 'community' edition, and so don't seem to have access to the required DLL in order to use the resource dictionary in that way. The workaround will have to suffice!

James.