Skip to content

Fix not being able to use Icon markup extensions as the Value of a Setter#1159

Merged
pomianowski merged 1 commit intolepoco:developmentfrom
reincubate:iconextension-setter-fix
Jul 24, 2024
Merged

Fix not being able to use Icon markup extensions as the Value of a Setter#1159
pomianowski merged 1 commit intolepoco:developmentfrom
reincubate:iconextension-setter-fix

Conversation

@Difegue
Copy link
Copy Markdown
Contributor

@Difegue Difegue commented Jul 12, 2024

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

Trying to use {ui:SymbolIcon} or {ui:FontIcon} extensions as the Value of a Setter in a Style will fail:

<ui:Button>
<ui:Button.Style>
    <Style TargetType="ui:Button" BasedOn="{StaticResource {x:Type ui:Button}}">
        <!-- Flip icon on RTL language -->
        <Setter Property="Icon" Value="{ui:SymbolIcon ArrowLeft24}" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:MainWindow}, Path=FlowDirection}" Value="{x:Static FlowDirection.RightToLeft}">
                <Setter Property="Icon" Value="{ui:SymbolIcon ArrowRight24}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
</ui:Button.Style>
</ui:Button>
SymbolIconExtension is not valid for Setter.Value. The only supported MarkupExtension types are DynamicResourceExtension and BindingBase or derived types.

Issue Number: N/A

What is the new behavior?

  • The extensions can be used in Setters again.

Other information

This change was brought in #1067 , but the incriminating lines don't seem to be related to the problem this PR was fixing (adding the missing constructor)

@Difegue Difegue requested a review from pomianowski as a code owner July 12, 2024 14:10
@github-actions github-actions bot added PR Pull request dotnet labels Jul 12, 2024
@Veritera
Copy link
Copy Markdown
Contributor

@Difegue if i remember correctly this specific part was already in the class and got only moved but feel free to correct me.

@Difegue
Copy link
Copy Markdown
Contributor Author

Difegue commented Jul 17, 2024

I don't believe that to be the case looking at the diff of the original PR, unless I've missed something 🤔

@Veritera
Copy link
Copy Markdown
Contributor

I don't believe that to be the case looking at the diff of the original PR, unless I've missed something 🤔

Hm ... looks like yeah. I could swear it was already in :s

@pomianowski
Copy link
Copy Markdown
Member

Hey @Difegue, thanks for the work you've put in

@pomianowski pomianowski merged commit 305ee57 into lepoco:development Jul 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2025
@Difegue Difegue deleted the iconextension-setter-fix branch February 16, 2026 15:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dotnet PR Pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants