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

How to: Provide accessible names for embedded controls

The following code shows how to use layout item labels (BaseLayoutItem.Text) as accessible names (Control.AccessibleName) for embedded controls. When you focus an embedded editor, an accessibility client application (for instance, Microsoft Narrator) reads the specified accessible name along with the editor’s value.

layoutcontrol-accessiblename-example.png

using DevExpress.XtraLayout;

private void Form1_Load(object sender, EventArgs e) {
    DevExpress.XtraLayout.Utils.ReadOnlyItemCollection items = layoutControl1.Items;
    foreach(BaseLayoutItem item in items) {
        LayoutControlItem lci = item as LayoutControlItem;
        if(lci != null) {
            if (lci.TextVisible)
                lci.Control.AccessibleName = lci.Text;
        }
    }
}