Skip to content

fix CheckBox animation throwing NullReferenceException on ObservableCollection changes#1660

Open
Muniwedesu wants to merge 1 commit intolepoco:mainfrom
Muniwedesu:main
Open

fix CheckBox animation throwing NullReferenceException on ObservableCollection changes#1660
Muniwedesu wants to merge 1 commit intolepoco:mainfrom
Muniwedesu:main

Conversation

@Muniwedesu
Copy link
Copy Markdown
Contributor

Use DependencyProperty for getting/setting the Tag property value to avoid it having the default value of 'null'

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?

Issue Number: #1140

What is the new behavior?

Other information

@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request release labels Feb 13, 2026
@chucker
Copy link
Copy Markdown
Collaborator

chucker commented Feb 13, 2026

Can you expand on what this fixes? You say #1140, but that one was closed (and thus presumably fixed) last year? Do you have a repro?

@Muniwedesu
Copy link
Copy Markdown
Contributor Author

Muniwedesu commented Feb 13, 2026

Can you expand on what this fixes? You say #1140, but that one was closed (and thus presumably fixed) last year? Do you have a repro?

That particular issue was with CardExpander and it was fixed, yes, this one does the same thing with CheckBox, maybe there are other controls like that.
And I should add that this only happens when resources are defined in the Window class (or anywhere else besides Application), I didn't notice that initially, sorry.

To reproduce just click on Remove/Clear button when checkbox is checked or was interacted with
wpfui-checkbox.zip

@Muniwedesu Muniwedesu changed the title fix NullReferenceException on ObservableCollection changes fix CheckBox animation throwing NullReferenceException on ObservableCollection changes Feb 14, 2026
@Nuklon
Copy link
Copy Markdown
Collaborator

Nuklon commented Mar 17, 2026

This is not complete, I don't have write access to the PR, but the Tag needs to be replaced as well:

                                        <controls:SymbolIcon.Clip>
                                            <MultiBinding Converter="{StaticResource ClipConverter}">
                                                <MultiBinding.Bindings>
                                                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
                                                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
                                                    <Binding Path="(animations:AnimationProperties.AnimationTagValue)" RelativeSource="{RelativeSource Self}" />
                                                </MultiBinding.Bindings>
                                            </MultiBinding>
                                        </controls:SymbolIcon.Clip>
                                        <animations:AnimationProperties.AnimationTagValue>
                                            <system:Double>1</system:Double>
                                        </animations:AnimationProperties.AnimationTagValue>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controls Changes to the appearance or logic of custom controls. PR Pull request release styles Topic is related to styles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants