> And here's the full style for NavigationWindow. This gives me some
> names to hit (like the border I want to use). Ultimately, I can redraw the
> border itself and leave everything else. It's still slightly more markup
> than I wanted (I'd rather add the control instead of redeclaring the
> butttons/text), but it still gets me what I wanted:
Yeah having to redo the whole chrome kinda stinks. :\ If they change the
default template on you your application is no longer going to look the same,
so it defeats the whole purpose.
That sample I posted earlier where you nest the original template within
the redefine is how it "should" work, but the fact that it's a Window control
is the problem there. :(
-Drew
<NavigationWindow>
<NavigationWindow.Style>
<Style TargetType="{x:Type NavigationWindow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Margin="10" CornerRadius="10" BorderThickness="2"
BorderBrush="blue" Background="silver">
<ContentPresenter Margin="10" Content="{TemplateBinding
NavigationWindow.Content}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
...
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Drew Marsh" <dru...@hotmail.no.spamming.com> wrote in message
news:b6983b4c9f0f98...@msnews.microsoft.com...
> Keith Patrick wrote:
>
>> I'm not quite following you on that.
>
> Basically what I meant was this:
>
> <NavigationWindow ...>
> <NavigationWindow.Style>
> <Style TargetType="{x:Type NavigationWindow}">
> <Setter Property="Template">
> <Setter.Value>
> <ControlTemplate TargetType="{x:Type NavigationWindow}">
> <NavigationWindow Style="{x:Null}">
> <Grid>
> <ColumnDefinition/>
> <RowDefinition Height="100"/>
> <RowDefinition/>
>
> <Rectangle Fill="Red" Grid.Column="0" Grid.Row="0"/>
> <ContentPresenter Content="{TemplateBinding Content}"/>
> </Grid>
> </NavigationWindow>
> </ControlTemplate>
> </Setter.Value>
> </Setter>
> </Style>
> </NavigationWindow.Style>
> </NavigationWindow>
>
> However, don't bother trying it... it doesn't work. :( I get the following
> exception:
>
> "Window must be the root of the tree. Cannot add window as a Logical or
> Visual child of any Visual."
>
> Which makes sense in 99.9% of the scenarios, but is unfortunate for this
> scenario. I guess we'll have to wait for a Microsoft rep to take a look at
> this scenario and provide a suggestion now. Sorry!
>
> Cheers,
> Drew
>
> ___________________________________
> Drew Marsh
> Chief Software Architect
> Mimeo.com, Inc. - http://www.mimeo.com
> Weblog - http://blog.hackedbrain.com/
>
>
> What CTP release are you using Drew? This style works with the
> September CTP release:
>
> <NavigationWindow>
> <NavigationWindow.Style>
> <Style TargetType="{x:Type NavigationWindow}">
> <Setter Property="Template">
> <Setter.Value>
> <ControlTemplate>
> <Border Margin="10" CornerRadius="10" BorderThickness="2"
> BorderBrush="blue" Background="silver">
> <ContentPresenter Margin="10" Content="{TemplateBinding
> NavigationWindow.Content}"/>
> </Border>
> </ControlTemplate>
> </Setter.Value>
> </Setter>
> </Style>
Yeah, that works no problem. Take a look at my declaration again. You'll
see that I'm attempting to actually just add to the default template by declaring
my own control template which in turn uses the default template declaration
for NavigationWindow inside of it. As a simpler example, imagine I wanted
all Labels in my application to have a border around them, I would do the
following (syntax not checked):
<Style x:Key="{x:Type Label}" TargetType="{x:Type Label}">
<Style Property="Template">
<Style.Value>
<Border BorderBrush="Red" BorderThickness="2">
<Label Style="{x:Null}" Content="{TemplateBinding Content}"/>
</Border>
</Style.Value>
</Style>
</Style>
So I'm redefining the default look of all Label's by adding a border around
them, yet retaining the built in look/functionality of the control within
the template because of the explicit Style="{x:Null}".
HTH,
Drew
Michael
"Drew Marsh" <dru...@hotmail.no.spamming.com> wrote in message
news:b6983b4c9f3748...@msnews.microsoft.com...
I haven't ever tried to Style/Template the navigation chrome myself, but
you should be able to nest the standard chrome control with a Style="{x:Null}"
inside of your Template which should give you the ability to add content
*around* the standard chrome.
Be sure to let us know how it works out for you!
Cheers,
Drew
> I would not expect this to work. Your style hides the standard
> styles. They are not keyed to null, but to the type as far as I have
> seen so far.
Duh, that's a good point. I guess it wouldn't retain any "look" at that point,
just behavior. Hmmm... been a long day I guess, my brain's not quite workin'
the way it should. Guess I spent too much time at the PDC. ;P
So then, does Keith really have to recreate the whole header template himself
just to "append" to the header? Granted he can use the correct style keys
to get the look of the individual controls himself (i.e. PFThemeNavigationWindowNavigationButtonBackButtonStyle),
but that doesn't guarentee him the same layout. Couldn't the navigation chrome
of the window be made into an individual control and NavigationWindow itself
just be a HeaderedContentControl which by default templates the header as
the navigation chrome control and then the pages get loaded into the content??
Cheers,
Drew
> I'm not quite following you on that.
Basically what I meant was this:
<NavigationWindow ...>
<NavigationWindow.Style>
<Style TargetType="{x:Type NavigationWindow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type NavigationWindow}">
Michael
"Keith Patrick" <richard_ke...@nospam.hotmail.com> wrote in message
news:OyRUdKXv...@TK2MSFTNGP15.phx.gbl...
Hmm, that's an interesting approach I didn't think of. Did you try the SystemParameters.NavigationChromeStyleKey[1]
for BasedOn instead??? Might give you the "real" chrome as opposed to whatever
this "down level" chrome is.
-Drew
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Drew Marsh" <dru...@hotmail.no.spamming.com> wrote in message
news:b6983b4c9f3788...@msnews.microsoft.com...