How to view all Visual Tree UI elements of any UI controls, Which is using styles & templates on windows 11 OS environment using VisualUIAVerifyNative tool?

Kavitha T 0 Reputation points
2024-09-11T12:08:30.5+00:00

VisualUIAVerifyNative is not displaying few UI elements

If TextBox uses style, which has TextBlock as PlaceholderText, then the placeholder textblock UI element is not getting displayed in VisualUIAVerifyNative on windows 11 machine

<Style x:Key="SearchTextBoxStyle"  TargetType="controls:SearchTextBox">
<Setter Property="Margin" Value="16,12,16,12" />
<Setter Property="BorderBrush" Value="{ThemeResource TextControlBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
<Setter Property="ContextFlyout" Value="{StaticResource TextControlCommandBarContextFlyout}" />
<Setter Property="MaxLength" Value="{StaticResource SearchTextInputMaxLength}" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto" />
<Setter Property="SelectionFlyout" Value="{StaticResource TextControlCommandBarSelectionFlyout}" />
<Setter Property="SelectionHighlightColor" Value="{ThemeResource TextControlSelectionHighlightColor}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:SearchTextBox">
.
.
.
<TextBlock x:Name="PlaceholderTextContentPresenter" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
VerticalAlignment="Center"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForeground}}"
IsHitTestVisible="False" Text="test Placeholder"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />

In above TextBox style, the UI element 'PlaceholderTextContentPresenter' textblock is not getting displayed in VisualUIAVerifyNative tool in windows 11 OS machine. However, it is getting displayed on windows 10 machine.

What would be the reason for not displaying few UI elements in VisualUIAVerifyNative tool?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,672 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
817 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.