Skip to main content

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.


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;