Version

Button Property (ActionButtonEventArgs)

Returns the Infragistics.Win.Misc.UltraNavigationBarActionButton with which this instance is associated.
Syntax
'Declaration
 
Public ReadOnly Property Button As UltraNavigationBarActionButton
public UltraNavigationBarActionButton Button {get;}
Example
The following code sample demonstrates how to configure an UltraNavigationBarActionButton to extend the ability to refresh the contents of the SelectedLocation's Locations collection:

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports System
Imports System.Drawing
Imports System.IO
Imports System.Collections.Generic
Imports System.ComponentModel
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports Infragistics.Win.Misc.UltraWinNavigationBar

Public Class FileSystemSupport

    Private Const PATH_SEPARATOR As String = "\"
    Private navigationBar As UltraNavigationBar = Nothing
    Private tree As UltraTree = Nothing
    Private _images As List(Of Bitmap) = New List(Of Bitmap)


    Public Sub New(ByVal navigationBar As UltraNavigationBar, ByVal tree As UltraTree)

        MyBase.New()

        '  Store references to the UltraNavigationBar and UltraTree
        Me.navigationBar = navigationBar
        Me.tree = tree

        '  Create the images we will use for the drives, folders, etc.
        Me.CreateImages()

        '  Assign the folder image to the general node and location appearances.
        Me.navigationBar.LocationSettings.Appearance.Image = Me.GetImage(Images.Folder)
        Me.tree.Override.NodeAppearance.Image = Me.GetImage(Images.Folder)

        '  Synchronize the ImageSize properties for each control.
        Me.tree.Override.ImageSize = Me.navigationBar.ImageSizeResolved

        '  Since we are lazily populating the nodes collections,
        '  show the expansion indicator initially for all nodes.
        Me.tree.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand

        '  Set any additional properties on the UltraTree.
        Me.tree.ScrollBounds = ScrollBounds.ScrollToFill
        Me.tree.Override.SelectionType = SelectType.Single
        Me.tree.HideSelection = False

        '  Add an action button so the end user can refresh the directories.
        Me.navigationBar.ActionButtons.Clear()
        Dim actionButton As UltraNavigationBarActionButton = Me.navigationBar.ActionButtons.Add("Refresh")
        actionButton.Settings.Appearance.Image = Me.GetImage(Images.Refresh)
			 actionButton.ToolTipText = "Refresh"

        '  Restrict the width of the location's text button so very long
        '  directory names don't hog up all the space.
        Me.navigationBar.LocationSettings.MaximumTextButtonWidth = 100

        '  Restrict the number of items that can appear in the locations dropdown list.
        Me.navigationBar.LocationSettings.MaximumDropDownItems = 10

        '  Register as a listener for the events of interest
        Me.HookEvents(True)
    End Sub

    ' Handles the UltraNavigationBar's 'ActionButtonToolTipDisplaying' event.
    Private Sub OnNavigationBarActionButtonToolTipDisplaying(ByVal sender As Object, ByVal e As ActionButtonToolTipDisplayingEventArgs)

        If (e.ActionButton.Key = "Refresh") Then

            '  Display the selected location's full path in the tooltip
            Dim navigationBar As UltraNavigationBar = sender

            Dim selectedLocation As UltraNavigationBarLocation = navigationBar.SelectedLocation
            Dim format As FullPathFormat = IIf(selectedLocation Is navigationBar.RootLocation, FullPathFormat.AllAncestors, FullPathFormat.EditMode)
            Dim path As String = selectedLocation.GetFullPath(format)
            e.ToolTipText = String.Format("{0} '{1}'", "Refresh", path)

        End If
    End Sub


    ' Handles the UltraNavigationBar's 'ActionButtonClicked' event.
    Private Sub OnNavigationBarActionButtonClicked(ByVal sender As Object, ByVal e As ActionButtonEventArgs)

        If (e.Button.Key = "Refresh") Then

            '  Call the NavigationBarLocationsCollection's Reset method, passing
            '  true for the value of the 'reInitialize' parameter. This will cause
            '  the InitializeLocations event to fire, which is our trigger point
            '  for the population of the collection.
            Dim navigationBar As UltraNavigationBar = sender
            Dim selectedLocation As UltraNavigationBarLocation = navigationBar.SelectedLocation
            selectedLocation.Locations.Reset(True)
        End If
    End Sub

End Class
using System;
using System.Drawing;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;
using Infragistics.Win.Misc.UltraWinNavigationBar;

    public class FileSystemSupport
    {
        private const string PATH_SEPARATOR = "\\";
        private UltraNavigationBar navigationBar = null;
        private UltraTree tree = null;

        public FileSystemSupport( UltraNavigationBar navigationBar, UltraTree tree )
        {
            //  Store references to the UltraNavigationBar and UltraTree
            this.navigationBar = navigationBar;
            this.tree = tree;

            //  Create the images we will use for the drives, folders, etc.
            this.CreateImages();

            //  Assign the folder image to the general node and location appearances.
            this.navigationBar.LocationSettings.Appearance.Image = this.GetImage( Images.Folder );
            this.tree.Override.NodeAppearance.Image = this.GetImage( Images.Folder );

            //  Synchronize the ImageSize properties for each control.
            this.tree.Override.ImageSize = this.navigationBar.ImageSizeResolved;

            //  Since we are lazily populating the nodes collections,
            //  show the expansion indicator initially for all nodes.
            this.tree.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand;

            //  Set any additional properties on the UltraTree.
            this.tree.ScrollBounds = ScrollBounds.ScrollToFill;
            this.tree.Override.SelectionType = SelectType.Single;
            this.tree.HideSelection = false;

            //  Add an action button so the end user can refresh the directories.
            this.navigationBar.ActionButtons.Clear();
            UltraNavigationBarActionButton actionButton = this.navigationBar.ActionButtons.Add( "Refresh" );
            actionButton.Settings.Appearance.Image = this.GetImage( Images.Refresh );
				  actionButton.ToolTipText = "Refresh";

            //  Restrict the width of the location's text button so very long
            //  directory names don't hog up all the space.
            this.navigationBar.LocationSettings.MaximumTextButtonWidth = 100;

            //  Restrict the number of items that can appear in the locations dropdown list.
            this.navigationBar.LocationSettings.MaximumDropDownItems = 10;

            //  Register as a listener for the events of interest
            this.HookEvents( true );
        }


        // Handles the UltraNavigationBar's 'ActionButtonToolTipDisplaying' event.
        private void OnNavigationBarActionButtonToolTipDisplaying(object sender, ActionButtonToolTipDisplayingEventArgs e)
        {
            if ( e.ActionButton.Key == "Refresh" )
            {
                //  Display the selected location's full path in the tooltip
                UltraNavigationBar navigationBar = sender as UltraNavigationBar;
                UltraNavigationBarLocation selectedLocation = navigationBar.SelectedLocation;
                FullPathFormat format = selectedLocation == navigationBar.RootLocation ? FullPathFormat.AllAncestors : FullPathFormat.EditMode;
                string path = selectedLocation.GetFullPath(format);
                e.ToolTipText = string.Format( "{0} \"{1}\"", "Refresh", path );
            }
        }

        // Handles the UltraNavigationBar's 'ActionButtonClicked' event.
        private void OnNavigationBarActionButtonClicked(object sender, ActionButtonEventArgs e)
        {
            if ( e.Button.Key == "Refresh" )
            {
                //  Call the NavigationBarLocationsCollection's Reset method, passing
                //  true for the value of the 'reInitialize' parameter. This will cause
                //  the InitializeLocations event to fire, which is our trigger point
                //  for the population of the collection.
                UltraNavigationBar navigationBar = sender as UltraNavigationBar;
                UltraNavigationBarLocation selectedLocation = navigationBar.SelectedLocation;
                selectedLocation.Locations.Reset( true );
            }
        }

    }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also