Click here to Skip to main content
15,881,812 members
Articles / Desktop Programming / WPF

WPF: A Nice View BreadCrumb Manager

Rate me:
Please Sign up or sign in to vote.
4.97/5 (80 votes)
16 Mar 2010CPOL20 min read 130.7K   3K   105  
A re-usable breadcrumb control for WPF.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">


    <!-- scroll viewer -->
    <Style x:Key="ScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
        <Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
    </Style>




    <!-- Add Dummy View Style -->
    <Style x:Key="addItemButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid ToolTip="{TemplateBinding ToolTip}">
                        <Ellipse x:Name="ell1" Stroke="Transparent" StrokeThickness="0" 
                                     Width="44" Height="44" HorizontalAlignment="Center"
									 VerticalAlignment="Center" Fill="Black"/>
                        <Ellipse x:Name="ell2" Stroke="Orange" StrokeThickness="2" 
                                     Width="40" Height="40" HorizontalAlignment="Center"
									 VerticalAlignment="Center" Fill="Black"/>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="ell2" Property="Fill" Value="LightGray"/>
                            <Setter TargetName="ell2" Property="Stroke" Value="LightGray"/>
                            <Setter TargetName="ell1" Property="Stroke" Value="Black"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <!-- Close app button -->
    <Style x:Key="CloseAppButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="bord" Width="Auto" Height="80" Background="Transparent" Opacity="1.0" >
                        <Label x:Name="lbl" Content="Ñ" FontFamily="Wingdings 2" 
                               FontSize="20" Foreground="Black" Padding="0"
                               VerticalAlignment="Center" HorizontalAlignment="Center"
                               VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
                    </Border>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="bord" Property="Background"  Value="Black"/>
                            <Setter TargetName="lbl" Property="Foreground"  Value="LightGray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- tooltip-->
    <Style TargetType="{x:Type ToolTip}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border BorderBrush="#ff656565" CornerRadius="3" 
                            Margin="0"
                            Background="Black" BorderThickness="2"
                            HorizontalAlignment="Center" 
                            VerticalAlignment="Center">
                        <ContentPresenter Content="{TemplateBinding Content}" 
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center" 
                            Margin="5" TextBlock.Foreground="LightGray" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    
</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

Comments and Discussions