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

Issue when binding DataTrigger and ChangePropertyAction.Value to same object #53

Closed
ThereGoesMySanity opened this issue Oct 20, 2020 · 0 comments

Comments

@ThereGoesMySanity
Copy link

ThereGoesMySanity commented Oct 20, 2020

When a DataTrigger and ChangePropertyAction are bound to the same object, the DataTrigger will call the ChangePropertyAction before the binding on the ChangePropertyAction has a chance to update.

Example code: (Button increments SelectedCount)

        <Button Name="Button" Command="{Binding OnClicked}" Content="{Binding SelectedCount}"/>
        <TextBlock Grid.Row="1">
            <i:Interaction.Behaviors>
                <ia:DataTriggerBehavior Binding="{Binding SelectedCount}" Value="0">
                    <ia:ChangePropertyAction Value="No items selected" PropertyName="Text"/>
                </ia:DataTriggerBehavior>
                <ia:DataTriggerBehavior Binding="{Binding SelectedCount}" Value="1">
                    <ia:ChangePropertyAction Value="1 item selected" PropertyName="Text"/>
                </ia:DataTriggerBehavior>
                <ia:DataTriggerBehavior Binding="{Binding SelectedCount}" Value="1" ComparisonCondition="GreaterThan">
                    <ia:ChangePropertyAction PropertyName="Text">
                        <ia:ChangePropertyAction.Value>
                            <Binding Path="SelectedCount" StringFormat="{}{0} items selected"/>
                        </ia:ChangePropertyAction.Value>
                    </ia:ChangePropertyAction>
                </ia:DataTriggerBehavior>
            </i:Interaction.Behaviors>
        </TextBlock>

Result:
Screenshot from 2020-10-20 02-41-11
Screenshot from 2020-10-20 02-41-27
Screenshot from 2020-10-20 02-41-38
Screenshot from 2020-10-20 02-41-48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants