Running OOB and fixing imageUri paths

Dec 27, 2010 at 10:22 AM
Edited Dec 27, 2010 at 10:22 AM

Hi again,

I integrated the control into my project as a referenced dll and there were 2 fixes in the source code that I needed to perform in order to run it properly:

  1. In PropertyGrid.AttachWheelEvents() and DetachWheelEvents() I had to surround the 3 lines beginning with "HtmlPage." with this condition:
    if( HtmlPage.IsEnabled ) {  ...  }
    in order to enable my app to run in Out Of Browser mode, which is a requirement.
  2. In PropertyGrid.GetHideImage() and GetShowImage() I needed to add a prefix to the imageUri parameter of GetImage() in order that the paths will be valid during runtime:
    Image img = GetImage("/SL40PropertyGrid;component/assets/xxxxx.png");
    - otherwise the images simply won't show.

Please consider whether these fixes should become permanent.


Dec 27, 2010 at 11:34 AM

Fixed... Please note, I have added another developer to this project, and they've made several new enhancements :). But most importantly the project structure has changed so you should make a copy of your latest local code, before you download this new version.

Dec 27, 2010 at 12:04 PM

Rapid improvements :)

So I think the cleverest thing will be to insert your project to my source control system so that I can merge your future changes with mine easily. Thanks!

Dec 27, 2010 at 12:07 PM

One of the changes to the project layout, is the PropertyGrid project itself is now just a component library versus all one big project. Should make it easier to integrate just the dll library.

Thanks for using the control!

Dec 27, 2010 at 12:14 PM

mmm... well, I think I'll still need to make some code editing since I want a completely different color scheme and styling. When one of you will be able to implement all the needed Dependancy Properties for controlling the looks of the control, as well as support for styling and maybe even templating - it will make the control a superb one!

But anyway, this seperation is a good move :)

Dec 27, 2010 at 12:16 PM

All the editors are controls already and everything already uses templates. So you could modify the Style as desired.

Dec 27, 2010 at 12:32 PM

Oh... thanks for this note. I'll explore the templating abilities further more (I'm quite a beginner at SL & WPF) and see if I get how to use them.

Dec 28, 2010 at 1:30 PM

Hi again,

I've tried to figure out how much style-able is the control, i.e. how can I control its style through Xaml definitions rather than code editing, but I didn't gather how to set even basic characteristics of it such as:

  • The grid's background color (say I wanted to have a Blend-style look)
  • Label's font and Label's text alignmend
  • Margin's color

and so on...

Can you explain a bit further what you meant by your last comment?

Appreciate your help,

Dec 28, 2010 at 11:21 PM
This is the xaml for the label (in generic.xaml), and then each control is it's own control, so you can define your own style as necessary (see:
	<!-- PropertyGridLabel-->
	<Style TargetType="u:PropertyGridLabel">
		<Setter Property="IsEnabled" Value="true" />
		<Setter Property="HorizontalAlignment" Value="Stretch" />
		<Setter Property="HorizontalContentAlignment" Value="Stretch" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="Cursor" Value="Arrow" />
		<Setter Property="Margin" Value="0" />
		<Setter Property="BorderThickness" Value="0" />
		<Setter Property="Template">
				<ControlTemplate TargetType="u:PropertyGridLabel">
					<Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
									ContentTemplate="{TemplateBinding ContentTemplate}" 
									Cursor="{TemplateBinding Cursor}" 
									HorizontalAlignment ="Stretch"
									FontFamily="{TemplateBinding FontFamily}" 
									FontSize="{TemplateBinding FontSize}" 
									FontStretch="{TemplateBinding FontStretch}" 
									Foreground="{TemplateBinding Foreground}" 
							<ContentPresenter Content="{TemplateBinding Content}"/>
And in the code is where it is defaulted background color is set, but can easily be changed. There is not much left to be modified as far as visuals go.
public partial class PropertyGrid : ContentControl
	#region Fields

	//internal static Color backgroundColor = Color.FromArgb(127, 153, 180, 209);

	internal static Color backgroundColor = Color.FromArgb(255, 233, 236, 250);
	internal static Color backgroundColorFocused = Color.FromArgb(255, 94, 170, 255);