Introduced
From the Vista, the Address bar has a great change, do not know what you feel, I feel very convenient, but also compatible with the function before, is a very good innovation. However, Microsoft is not going to make this cool feature available to the vast majority of developers.
This article provides a simple address bar implementation that uses. NET 2.0 and VS2008. It is implemented on the basis of a simple tree traversal, and applies to various cascading data.
The demo provides a very simple example that allows you to browse the file system. Here is a demonstration of how it works.
Using code
The easiest way to understand the implementation is to download the source code directly, then open the game to see ~
Under Design-time, drag the address Bar control into the form, and then add the following line of code to the constructor:
//Initialize the bar with a root node type. this .AdBar.InitializeRoot( new FileSystemNode()); |
You only need to pass in a root node, and the root node will provide information for control. Filesystemnode contains the first logical disk information after installation of the Windows system. To implement the Iaddressnode type, there are three important methods that you need to implement yourself:
UpdateNode() - Used to update the node itself
for
any changes (e.g.
in
the FileSystemNode it checks
for child folder changes and folder name changes)
GetChild() - Searches
for
a given child node based
on
a unique ID (A Unique ID being whatever you define it
as
. In FileSystemNode, we use an absolute path
for
a folder
as
the unique ID).
Clone() - Clones a given node
as
a separate value copy (rather than just
by
reference).
|
Windows 7 style Address bar control implementation