mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +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">
|
SelectionMode="None">
|
||||||
<GridView.ItemsPanel>
|
<GridView.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<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>
|
</ItemsPanelTemplate>
|
||||||
</GridView.ItemsPanel>
|
</GridView.ItemsPanel>
|
||||||
<GridView.ItemTemplate>
|
<GridView.ItemTemplate>
|
||||||
|
|||||||
@@ -53,7 +53,15 @@
|
|||||||
TextTrimming="WordEllipsis"
|
TextTrimming="WordEllipsis"
|
||||||
TextWrapping="NoWrap">
|
TextWrapping="NoWrap">
|
||||||
<ToolTipService.ToolTip>
|
<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>
|
</ToolTipService.ToolTip>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@@ -95,7 +103,15 @@
|
|||||||
TextTrimming="WordEllipsis"
|
TextTrimming="WordEllipsis"
|
||||||
TextWrapping="NoWrap">
|
TextWrapping="NoWrap">
|
||||||
<ToolTipService.ToolTip>
|
<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>
|
</ToolTipService.ToolTip>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|||||||
@@ -74,8 +74,14 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Width="12"
|
Width="12"
|
||||||
Height="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
|
<TextBlock
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="0,-1,0,0"
|
Margin="0,-1,0,0"
|
||||||
|
|||||||
@@ -257,13 +257,29 @@
|
|||||||
<VisualState x:Name="HeroContentTop">
|
<VisualState x:Name="HeroContentTop">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="HeroContentBorder.(Grid.Row)" Value="0" />
|
<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.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="HeroContentBottom">
|
<VisualState x:Name="HeroContentBottom">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="HeroContentBorder.(Grid.Row)" Value="2" />
|
<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.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
|
|||||||
@@ -158,12 +158,24 @@
|
|||||||
Grid.ColumnSpan="1"
|
Grid.ColumnSpan="1"
|
||||||
Margin="{TemplateBinding BorderThickness}"
|
Margin="{TemplateBinding BorderThickness}"
|
||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForeground}}"
|
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
Text="{TemplateBinding PlaceholderText}"
|
Text="{TemplateBinding PlaceholderText}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}"
|
TextWrapping="{TemplateBinding TextWrapping}">
|
||||||
Visibility="{Binding Description, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ReverseStringVisibilityConverter}, Mode=OneWay}" />
|
<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
|
<Button
|
||||||
x:Name="DeleteButton"
|
x:Name="DeleteButton"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
@@ -188,9 +200,15 @@
|
|||||||
CharacterSpacing="15"
|
CharacterSpacing="15"
|
||||||
FontFamily="{TemplateBinding FontFamily}"
|
FontFamily="{TemplateBinding FontFamily}"
|
||||||
FontSize="{TemplateBinding FontSize}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={ThemeResource TextControlPlaceholderForeground}}"
|
|
||||||
Text="{TemplateBinding Description}"
|
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>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
<VisualState x:Name="Normal" />
|
<VisualState x:Name="Normal" />
|
||||||
@@ -212,7 +230,14 @@
|
|||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
|
||||||
</ObjectAnimationUsingKeyFrames>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
<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>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
@@ -225,20 +250,41 @@
|
|||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
|
||||||
</ObjectAnimationUsingKeyFrames>-->
|
</ObjectAnimationUsingKeyFrames>-->
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
<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>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
|
||||||
</ObjectAnimationUsingKeyFrames>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DescriptionPresenter" Storyboard.TargetProperty="Foreground">
|
<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>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="Focused">
|
<VisualState x:Name="Focused">
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
<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>
|
||||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
|
||||||
@@ -253,7 +299,14 @@
|
|||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
|
||||||
</ObjectAnimationUsingKeyFrames>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DescriptionPresenter" Storyboard.TargetProperty="Foreground">
|
<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>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
|
|||||||
Reference in New Issue
Block a user