mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 01:36:31 +02:00
CmdPal: Expand Binding markup extensions to nested elements to avoid WMC1510 (#45830)
## Summary of the Pull Request This PR expands all Binding XAML markup expressions to nested elements, which in turn prevents compiler from generating `WMC1510 Ensure the property path is trimming and AOT compatible` warnings. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Related to: #42574
This commit is contained in:
@@ -193,7 +193,11 @@
|
||||
SelectionMode="None">
|
||||
<GridView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<controls:UniformGrid ui:FrameworkElementExtensions.AncestorType="local:ColorPalette" Columns="{Binding (ui:FrameworkElementExtensions.Ancestor).CustomPaletteColumnCount, RelativeSource={RelativeSource Self}}" />
|
||||
<controls:UniformGrid ui:FrameworkElementExtensions.AncestorType="local:ColorPalette">
|
||||
<controls:UniformGrid.Columns>
|
||||
<Binding Path="(ui:FrameworkElementExtensions.Ancestor).CustomPaletteColumnCount" RelativeSource="{RelativeSource Self}" />
|
||||
</controls:UniformGrid.Columns>
|
||||
</controls:UniformGrid>
|
||||
</ItemsPanelTemplate>
|
||||
</GridView.ItemsPanel>
|
||||
<GridView.ItemTemplate>
|
||||
|
||||
@@ -53,7 +53,15 @@
|
||||
TextTrimming="WordEllipsis"
|
||||
TextWrapping="NoWrap">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind Title, Mode=OneWay}" Visibility="{Binding IsTextTrimmed, ElementName=TitleTextBlock, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<ToolTip x:DataType="TextBlock" Content="{x:Bind Title, Mode=OneWay}">
|
||||
<ToolTip.Visibility>
|
||||
<Binding
|
||||
Converter="{StaticResource BoolToVisibilityConverter}"
|
||||
ElementName="TitleTextBlock"
|
||||
Mode="OneWay"
|
||||
Path="IsTextTrimmed" />
|
||||
</ToolTip.Visibility>
|
||||
</ToolTip>
|
||||
</ToolTipService.ToolTip>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
@@ -95,7 +103,15 @@
|
||||
TextTrimming="WordEllipsis"
|
||||
TextWrapping="NoWrap">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind Title, Mode=OneWay}" Visibility="{Binding IsTextTrimmed, ElementName=TitleTextBlock, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<ToolTip Content="{x:Bind Title, Mode=OneWay}">
|
||||
<ToolTip.Visibility>
|
||||
<Binding
|
||||
Converter="{StaticResource BoolToVisibilityConverter}"
|
||||
ElementName="TitleTextBlock"
|
||||
Mode="OneWay"
|
||||
Path="IsTextTrimmed" />
|
||||
</ToolTip.Visibility>
|
||||
</ToolTip>
|
||||
</ToolTipService.ToolTip>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
|
||||
@@ -74,8 +74,14 @@
|
||||
Grid.Column="0"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Margin="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource IconMarginConverter}}"
|
||||
SourceKey="{TemplateBinding Icon}" />
|
||||
SourceKey="{TemplateBinding Icon}">
|
||||
<local:IconBox.Margin>
|
||||
<Binding
|
||||
Converter="{StaticResource IconMarginConverter}"
|
||||
Path="Text"
|
||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</local:IconBox.Margin>
|
||||
</local:IconBox>
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="0,-1,0,0"
|
||||
|
||||
@@ -257,13 +257,29 @@
|
||||
<VisualState x:Name="HeroContentTop">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="HeroContentBorder.(Grid.Row)" Value="0" />
|
||||
<Setter Target="HeroContentBorder.CornerRadius" Value="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TopCornerRadiusFilterConverter}, FallbackValue=0}" />
|
||||
<Setter Target="HeroContentBorder.CornerRadius">
|
||||
<Setter.Value>
|
||||
<Binding
|
||||
Converter="{StaticResource TopCornerRadiusFilterConverter}"
|
||||
FallbackValue="0"
|
||||
Path="CornerRadius"
|
||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="HeroContentBottom">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="HeroContentBorder.(Grid.Row)" Value="2" />
|
||||
<Setter Target="HeroContentBorder.CornerRadius" Value="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BottomCornerRadiusFilterConverter}, FallbackValue=0}" />
|
||||
<Setter Target="HeroContentBorder.CornerRadius">
|
||||
<Setter.Value>
|
||||
<Binding
|
||||
Converter="{StaticResource BottomCornerRadiusFilterConverter}"
|
||||
FallbackValue="0"
|
||||
Path="CornerRadius"
|
||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
|
||||
@@ -158,12 +158,24 @@
|
||||
Grid.ColumnSpan="1"
|
||||
Margin="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForeground}}"
|
||||
IsHitTestVisible="False"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}"
|
||||
Visibility="{Binding Description, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ReverseStringVisibilityConverter}, Mode=OneWay}" />
|
||||
TextWrapping="{TemplateBinding TextWrapping}">
|
||||
<TextBlock.Visibility>
|
||||
<Binding
|
||||
Converter="{StaticResource ReverseStringVisibilityConverter}"
|
||||
Mode="OneWay"
|
||||
Path="Description"
|
||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</TextBlock.Visibility>
|
||||
<TextBlock.Foreground>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForeground}" />
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
<Button
|
||||
x:Name="DeleteButton"
|
||||
Grid.Column="2"
|
||||
@@ -188,9 +200,15 @@
|
||||
CharacterSpacing="15"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForeground}}"
|
||||
Text="{TemplateBinding Description}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||
TextWrapping="{TemplateBinding TextWrapping}">
|
||||
<TextBlock.Foreground>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForeground}" />
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
@@ -212,7 +230,14 @@
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForegroundDisabled}}" />
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
@@ -225,20 +250,41 @@
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>-->
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForegroundPointerOver}}" />
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DescriptionPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForegroundPointerOver}}" />
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Focused">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForegroundFocused}}" />
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForegroundFocused}" />
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
|
||||
@@ -253,7 +299,14 @@
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DescriptionPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForegroundFocused}}" />
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Binding
|
||||
Path="PlaceholderForeground"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
TargetNullValue="{ThemeResource TextControlPlaceholderForegroundFocused}" />
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
Reference in New Issue
Block a user