Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AppMenuFileLabel Class

A label that imitates an item in the Recent Documents pane in MS Office 2007 UI. This is a custom-made control designed for the Ribbon Simple Pad demo, and is not included in the official WinForms Controls line-up. User discretion is advised. We recommend that you use the RecentItemControl instead.

Namespace: DevExpress.XtraBars.Ribbon

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

public class AppMenuFileLabel :
    BaseStyleControl

#Remarks

Labels represented by the AppMenuFileLabel class imitate links to recently used documents in MS Office 2007 UI. You can add these links to any control container. For example, you can use them within the right pane of an ApplicationMenu.

AppMenuFileLabel_Class

The main features of AppMenuFileLabel objects are listed below. Labels can:

#Example

The following example shows how to add a label used to represent a link to a file. The label will be displayed in the right pane of an ApplicationMenu within a RibbonForm.

It is assumed that ApplicationMenu and PopupControlContainer components have been added to the form. The ApplicationMenu is assigned to the RibbonControl.ApplicationButtonDropDownControl property, so it will be displayed when the Application Button is clicked. The PopupControlContainer is assigned to the ApplicationMenu.RightPaneControlContainer property, and it will be displayed within the menu’s right pane.

In the example, an AppMenuFileLabel object is used to represent a link to a file. These object types imitate links to recent documents found in MS Office 2007 UI.

An AppMenuFileLabel object is customized and added to the created PopupControlContainer. It will be displayed in the right pane of the Application Menu. The label displays a file’s name and a check button used to toggle the label’s check state.

The AppMenuFileLabel.LabelClick event is handled to respond to a label click.

using System;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;

void Form1_Load(object sender, EventArgs e) {
    // Associate an ApplicationMenu with the RibbonForm's ApplicationButton.
    ribbonControl1.ApplicationButtonDropDownControl = applicationMenu1;
    // Add an item to the menu.
    BarButtonItem barButtonItem1 = new BarButtonItem(ribbonControl1.Manager, "Menu Item");
    applicationMenu1.ItemLinks.Add(barButtonItem1);
    // Enable the right pane in the Application Menu.
    applicationMenu1.ShowRightPane = true;
    // Specify the container to be displayed within the right pane.
    applicationMenu1.RightPaneControlContainer = popupControlContainer1;

    // Create a label representing the "Document1.rtf" file.
    AppMenuFileLabel label1 = new AppMenuFileLabel();

    // Customize the label's settings.
    label1.Dock = DockStyle.Top;
    label1.AutoHeight = true;
    label1.Caption = "Document1.rtf";
    label1.ShowCheckButton = true;
    // SVG images are obtained from the svgImageCollection1 created and populated with SVG images at design-time.
    // SVG images are specified by their names.
    // The svgImageCollection1.ImageSize property specifies the image size (16x16 by default).
    label1.ImageOptionsCollection["Image"].SvgImage = svgImageCollection1["unpinbutton"];
    label1.ImageOptionsCollection["SelectedImage"].SvgImage = svgImageCollection1["pinbutton"];
    // Fires when the label is clicked
    label1.LabelClick += Label1_LabelClick;
    // Custom data associated with the label.
    // It can be used to identify the label in the LabelClick event.
    label1.Tag = "c:\\My Documents\\Document1.rtf";

    // Add the label to the container.
    popupControlContainer1.Controls.Add(label1);
}

void Label1_LabelClick(object sender, EventArgs e) {
    //...
}

#Inheritance

See Also