This project is read-only.

Customizing the look of GlassWindow

Jan 1, 2009 at 5:03 PM
Pavan,

First, thanks for releasing this great set of controls!

I want to ensure that I'm approaching this in the appropriate manner, because it seems a little clumsy.

I want to change the background of the GlassWindow, and from what I have read in other posts, the guidance is to override GlassWindow.generic.xaml and VistaBackground.xaml. Customizing the entire ControlTemplate just to change the background seems a little overkill to me.

Am I going to about this the right way?

Thanks,
Sean
Jan 2, 2009 at 1:27 AM
Hi Sean,
        Yes, changing an entire ControlTemplate is overkill. What you could do is  to make sure the ControlTemplate use TemplateBinding to bind to the Background property. That way you could set whatever Background Brush you like, directly on the GlassWindow and that would get used inside of the ControlTemplate. So, in your usage you could have something like:

<GlassWindow Background="{Your Brush}" />


and inside of the Template, you will have some element which template-binds to this background:

<ControlTemplate TargetType="GlassWindow">
<Grid>
      ...
       <Border Background="{TemplateBinding Background}" />
...
</Grid>
</ControlTemplate>


Hope that helps,
Pavan
Jan 3, 2009 at 11:45 PM
Thanks Pavan!

That's exactly what I was looking for! Again, thanks for creating this wonderful set of controls for the community.