0

Is the only way to set the automation properties of the DataGridTemplateColumn to inherit it in a new control and override the AutomationPeer?

Considering the following, I end up with two entries in the UI tree.

  • one for the FontIcon, that's contained within
  • one for the DataGridCell
    <controls:DataGridTemplateColumn Header="Symbol">
        <controls:DataGridTemplateColumn.CellTemplate>
            <DataTemplate x:DataType="model:SampleOrder">
                <FontIcon
                    AutomationProperties.Name="{x:Bind SymbolName}"
                    Margin="{StaticResource SmallLeftRightMargin}"
                    HorizontalAlignment="Left"
                    FontFamily="{ThemeResource SymbolThemeFontFamily}"
                    Glyph="{x:Bind Symbol}" />
            </DataTemplate> 
        </controls:DataGridTemplateColumn.CellTemplate>
    </controls:DataGridTemplateColumn>

I can set AutomationProperties on the FontIcon but there doesn't appear to be a way to stop the control rendering a "custom" container element with a null/empty name.

For clarification, here's the UI Automation Tree that includes the "custom" container for the cell. partial screenshot of UIATree showing empty custom container

Such output does not meet basic accessibility requirements (specifically section 508 502.3.1).

The custom value comes from here but there doesn't seem to be a way to change this without subclassing.

Being forced to derive a custom control just to be able to set basic accessibility properties seems unnecessary. Is there an easier way?

Aside: I know that in the screenshot the Globe text is incorrectly listed as a 'group' but I know how to fix that. It's separate to the question I'm asking.


UPDATE

I asked the original question (above) before attempting to see if subclassing was possible. It's not as the necessary classes are sealed. :(

4

0 回答 0