none
using navigation buttons

    Question

  • Hello,

     

    is there a way to use the navigation buttons which NavigationWindow uses alone? I mean I just to use those buttons and implement my own functionality because the possibilities of NavigationWindow or Frame doesn't fit my requirements.

     

    If someone is interested in my problem. I am trying to implement a dynamic queue. The content of the queue should be displayed and you should be able to navigate through the queue with the navigation buttons. According that the queue is getting changed asynchron in the background I can't really use NavigationWindow or Frame.

     

    Does anyone can answer me my first question or has an approch how to solve my problem????

     

     

    Cheers

     

    Chris

     

     

     

    Tuesday, September 11, 2007 9:26 AM

Answers

  • I'm not sure what your problem is. If you have difficulty using the tool, just use this code snippet to extract NavigationWindow's default style. [Note: There seems to be a typo: The method name is FindResource().] Or just use the copy I put here.

    The navigation buttons will appear disabled normally. That's because they are tied to the navigation commands (BrowseBack/BrowseForward). There are ControlTemplate triggers that respond to changes to the IsEnabled property. If there is a handler for these commands along the normal route the commands are bubbled through, the buttons will become enabled. (You could set the buttons' CommandTarget explicitly.)

    You shouldn't use this style literally. Rather, it can just give you an idea of what's in the built-in ControlTemplate, and you can, of course, reuse pieces of it (like the button graphics).

     

    Thursday, September 13, 2007 4:49 PM
  • What exactly is the problem?

    How do you expect this Syle to be applied to your buttons? You have to either set the Button.Style property to refer to the style or set Style.TargetType so that the framework can find the style automatically.

     

    Wednesday, September 19, 2007 4:29 PM
  • Thanks,

     

    I figured it out. It was a typo, that's why it didn't affect my buttons. Now it works.

     

    Thanks for help.

     

    Friday, September 21, 2007 9:37 AM

All replies

  • You could extract the built-in ControlTemplate of NavigationWindow and tie your custom logic to it. You may choose to change the commands that the buttons generate or just set up handlers for NavigationCommands.BrowseBack & .BrowseForward. Here's one tool to view the built-in styles: http://www.codeplex.com/TemplateViewer.

     

    Wednesday, September 12, 2007 7:08 PM
  • The problem with the approach you told me is that the navigation buttons not really appear so you cant't extract the template from them. They appear dynamically when you have more than one page.

     

    Also the NavigationWindow don't have a *.Template property which is shown in the link above because it isn't a control.

     

    Any ideas how to work around that???

     

    Thursday, September 13, 2007 11:11 AM
  • I'm not sure what your problem is. If you have difficulty using the tool, just use this code snippet to extract NavigationWindow's default style. [Note: There seems to be a typo: The method name is FindResource().] Or just use the copy I put here.

    The navigation buttons will appear disabled normally. That's because they are tied to the navigation commands (BrowseBack/BrowseForward). There are ControlTemplate triggers that respond to changes to the IsEnabled property. If there is a handler for these commands along the normal route the commands are bubbled through, the buttons will become enabled. (You could set the buttons' CommandTarget explicitly.)

    You shouldn't use this style literally. Rather, it can just give you an idea of what's in the built-in ControlTemplate, and you can, of course, reuse pieces of it (like the button graphics).

     

    Thursday, September 13, 2007 4:49 PM
  • Thanks for providing me the template.

     

    I extracted the part which should affect the buttons. But the buttons doesn't look like the navigation buttons from navigationwindow.

    I used the following code snippet:

     

    Code Snippet

    <Style x:Key="Test">

    <Setter Property="Control.Template">

    <Setter.Value>

    <ControlTemplate TargetType="{x:Type Button}">

    <Grid Background="#00FFFFFF" Width="24" Height="24">

    <Ellipse StrokeThickness="1" Name="Circle" Grid.Column="0">

    <Ellipse.Fill>

    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FFFFFFFF" Offset="0" />

    <GradientStop Color="#FFCCD4E9" Offset="0.1" />

    <GradientStop Color="#FF4881D2" Offset="0.47" />

    <GradientStop Color="#FF001A5A" Offset="0.47" />

    <GradientStop Color="#FF007BD6" Offset="0.7" />

    <GradientStop Color="#FF54DAFF" Offset="0.85" />

    <GradientStop Color="#FF86FFFF" Offset="0.95" />

    <GradientStop Color="#FFFFFFFF" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Ellipse.Fill>

    <Ellipse.Stroke>

    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FF6C90C4" Offset="0" />

    <GradientStop Color="#FF315BB4" Offset="0.5" />

    <GradientStop Color="#FF002091" Offset="0.5" />

    <GradientStop Color="#FF08377C" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Ellipse.Stroke>

    </Ellipse>

    <Path Data="M0.37,7.69L5.74,14.2A1.5,1.5,0,1,0,10.26,12.27L8.42,10.42 14.9,10.39A1.5,1.5,0,1,0,14.92,5.87L8.44,5.9 10.31,4.03A1.5,1.5,0,1,0,5.79,1.77z" StrokeThickness="0.75" Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0" Grid.Column="0">

    <Path.Fill>

    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FFFFFFFF" Offset="0.5" />

    <GradientStop Color="#FFEEEEEE" Offset="0.5" />

    <GradientStop Color="#FFB0B0B0" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Path.Fill>

    <Path.Stroke>

    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FF8AB1FB" Offset="0" />

    <GradientStop Color="#FF002874" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Path.Stroke>

    <Path.RenderTransform>

    <ScaleTransform ScaleX="-1" />

    </Path.RenderTransform>

    </Path>

    </Grid>

    <ControlTemplate.Triggers>

    <Trigger Property="UIElement.IsEnabled">

    <Setter Property="Shape.Fill" TargetName="Circle">

    <Setter.Value>

    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FFFFFFFF" Offset="0" />

    <GradientStop Color="#FFEBEEF5" Offset="0.5" />

    <GradientStop Color="#FFD8DDEB" Offset="0.5" />

    <GradientStop Color="#FFDFE2F0" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Setter.Value>

    </Setter>

    <Setter Property="Shape.Stroke" TargetName="Circle">

    <Setter.Value>

    <SolidColorBrush>#FFB5BACE</SolidColorBrush>

    </Setter.Value>

    </Setter>

    <Setter Property="Shape.Stroke" TargetName="Arrow">

    <Setter.Value>

    <SolidColorBrush>#B0B5BACE</SolidColorBrush>

    </Setter.Value>

    </Setter>

    <Setter Property="Shape.Fill" TargetName="Arrow">

    <Setter.Value>

    <SolidColorBrush>#D0FFFFFF</SolidColorBrush>

    </Setter.Value>

    </Setter>

    <Trigger.Value>

    <s:Boolean>True</s:Boolean>

    </Trigger.Value>

    </Trigger>

    <Trigger Property="UIElement.IsMouseOver">

    <Setter Property="Shape.Fill" TargetName="Circle">

    <Setter.Value>

    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FFFFFFFF" Offset="0" />

    <GradientStop Color="#FFDFEDF9" Offset="0.1" />

    <GradientStop Color="#FF3086E1" Offset="0.47" />

    <GradientStop Color="#FF003B91" Offset="0.47" />

    <GradientStop Color="#FF1793EF" Offset="0.7" />

    <GradientStop Color="#FF5AD4FF" Offset="0.85" />

    <GradientStop Color="#FFBDFFFF" Offset="0.95" />

    <GradientStop Color="#FFFFFFFF" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Setter.Value>

    </Setter>

    <Trigger.Value>

    <s:Boolean>True</s:Boolean>

    </Trigger.Value>

    </Trigger>

    <Trigger Property="ButtonBase.IsPressed">

    <Setter Property="Shape.Fill" TargetName="Circle">

    <Setter.Value>

    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">

    <LinearGradientBrush.GradientStops>

    <GradientStop Color="#FFC0D2F5" Offset="0" />

    <GradientStop Color="#FF5E7A9C" Offset="0.47" />

    <GradientStop Color="#FF00062D" Offset="0.47" />

    <GradientStop Color="#FF005F9F" Offset="0.7" />

    <GradientStop Color="#FF1FA4E2" Offset="0.85" />

    <GradientStop Color="#FF61DAFF" Offset="0.95" />

    <GradientStop Color="#FF48CFFF" Offset="1" />

    </LinearGradientBrush.GradientStops>

    </LinearGradientBrush>

    </Setter.Value>

    </Setter>

    <Trigger.Value>

    <s:Boolean>True</s:Boolean>

    </Trigger.Value>

    </Trigger>

    </ControlTemplate.Triggers>

    </ControlTemplate>

    </Setter.Value>

    </Setter>

    </Style>

     

     

     

    Why doesn't affect it my buttons?

     

     

    Monday, September 17, 2007 6:50 AM
  • Does nobody can help me with that problem?

    Wednesday, September 19, 2007 6:58 AM
  • What exactly is the problem?

    How do you expect this Syle to be applied to your buttons? You have to either set the Button.Style property to refer to the style or set Style.TargetType so that the framework can find the style automatically.

     

    Wednesday, September 19, 2007 4:29 PM
  • Thanks,

     

    I figured it out. It was a typo, that's why it didn't affect my buttons. Now it works.

     

    Thanks for help.

     

    Friday, September 21, 2007 9:37 AM