Click here to Skip to main content
15,897,187 members
Articles / Desktop Programming / WPF

WPF BreadcrumbBar

Rate me:
Please Sign up or sign in to vote.
4.93/5 (47 votes)
3 Oct 2008CPOL4 min read 170.3K   4.6K   162  
A WPF BreadcrumbBar implementation.
<Window x:Class="FileBrowser.cs.Browser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:odc="clr-namespace:Odyssey.Controls;assembly=Odyssey"
    xmlns:local="clr-namespace:FileBrowser.cs"
    Title="BreadcrumbBar Browser Demo" Height="300" Width="700" Background="LightSteelBlue">
    <Window.Resources>
        <DataTemplate DataType="{x:Type local:FolderItem}">
            <TextBlock Text="{Binding Folder}"/>
        </DataTemplate>
        <Style TargetType="{x:Type odc:BreadcrumbItem}">
            <Setter Property="Image" Value="Web.png"/>
        </Style>
    </Window.Resources>
    <DockPanel Margin="4">
        <odc:BreadcrumbBar x:Name="bar"    Focusable="True"
                           DockPanel.Dock="Top" 
                           Path="Computer\C:\"
                           PopulateItems="BreadcrumbBar_PopulateItems"    
                           BreadcrumbItemDropDownOpened="bar_BreadcrumbItemDropDownOpened"
                           TraceBinding="{Binding Folder}"
                           ImageBinding="{Binding Image}"
                           PathConversion="BreadcrumbBar_PathConversion">
            <odc:BreadcrumbBar.Buttons>
                <Button Click="Button_Click">Refresh</Button>
            </odc:BreadcrumbBar.Buttons>
            <odc:BreadcrumbBar.DropDownItems>
                <TextBlock Text="C:\Windows"/>
                <TextBlock Text="C:\Windows\System32"/>
                <TextBlock Text="C:\Users"/>
            </odc:BreadcrumbBar.DropDownItems>
            <odc:BreadcrumbItem Header="Desktop">
                <odc:BreadcrumbItem Header="Computer"/>
                <odc:BreadcrumbItem Header="Network"/>
                <odc:BreadcrumbItem Header="Control Panel"/>
                <odc:BreadcrumbItem Header="Recylce bin"/>
            </odc:BreadcrumbItem>
        </odc:BreadcrumbBar>
        <StatusBar DockPanel.Dock="Bottom" Background="Transparent">
            <TextBlock DockPanel.Dock="Bottom" Text="{Binding Path, ElementName=bar}"/>
        </StatusBar>
        <Grid>
        </Grid>
    </DockPanel>
</Window>

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)
Germany Germany
MCPD
Enterprise Application Developer 3.5
Windows Developer 3.5
.ASP.NET Developer 3.5
.NET 2.0 Windows Developer
.NET 2.0 Web Developer
.NET 2.0 Enterprise Application Developer


MCTS
.NET 3.5 Windows Forms Applications
.NET 3.5 ASP.NET Applications
.NET 3.5, ADO.NET Application Development
.NET 3.5 WCF
.NET 3.5 WPF
.NET 3.5 WF
Microsoft SQL Server 2008, Database Development
.NET 2.0 Windows Applications
.NET 2.0 Web Applications
.NET 2.0 Distributed Applications
SQL Server 2005
Sharepoint Services 3.0 Application Development
Windows Vista Client Configuration

Comments and Discussions