Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use accessible Foreground on WatermarkedTextbox in Add Package Source Mapping dialog #4856

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,47 @@
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ScrollBarColorKey}}"/>
</Style>
<!-- Copied from ThemedDialogResources.xaml. See https://github.com/NuGet/Home/issues/12163 -->
<Style TargetType="{x:Type vsui:WatermarkedTextBox}">
<Setter Property="Padding" Value="6,8,6,8" />
<Setter Property="AutomationProperties.HelpText" Value="{Binding Watermark}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type vsui:WatermarkedTextBox}">
<Border x:Name="border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True">
<Grid>
<ScrollViewer x:Name="PART_ContentHost"
Padding="{TemplateBinding Padding}"
Focusable="false"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"/>
<TextBlock VerticalAlignment="Center"
x:Name="WatermarkTextBlock"
Visibility="Collapsed"
Cursor="IBeam"
Padding="{TemplateBinding Padding}"
Margin="2,0,0,0"
Text="{TemplateBinding Watermark}"
IsHitTestVisible="False"
Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter TargetName="WatermarkTextBlock" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<StackPanel Grid.Row="0">
<Grid>
Expand Down Expand Up @@ -63,18 +104,18 @@
<StackPanel Grid.Row="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="*"/>
<RowDefinition Height="36"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<vsui:WatermarkedTextBox Grid.Row="0"
BorderBrush="{DynamicResource {x:Static vsui:CommonControlsColors.ButtonBorderBrushKey}}"
BorderThickness="1"
AutomationProperties.Name="{x:Static nuget:Resources.VSOptions_Watermark_AddPackageNamespace}"
x:Name="_packageID"
MaxLength="100"
Margin="12,6,12,6"
Watermark="{x:Static nuget:Resources.VSOptions_Watermark_AddPackageNamespace}"
Foreground="{Binding Path=(TextElement.Foreground), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
Background="{Binding Path=(Window.Background), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
TextChanged="PackageID_TextChanged"/>
<StackPanel Orientation="Vertical" Grid.Row="1">
<nuget:ProjectsListView AutomationProperties.Name="{x:Static nuget:Resources.VSOptions_Accessibility_SourcesList}"
Expand Down