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

ColorGallery SelectedColorChanged issue #413

Closed
User3290 opened this issue Mar 14, 2017 · 2 comments
Closed

ColorGallery SelectedColorChanged issue #413

User3290 opened this issue Mar 14, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@User3290
Copy link

This issue is continuation of the previous topic
#398 you marked as resolved for 5.0 version of fluent

But at current moment i continue receive an old value in the handler of command, although your code is fixed

<fluent:ColorGallery x:Name="CellFillColorPicker"
                                                     Mode="ThemeColors"
                                                     IsAutomaticColorButtonVisible="False"
                                                     ThemeColorGridRows="0"
                                                     Columns="10"
                                                     IsNoColorButtonVisible="True">
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="SelectedColorChanged">
                                            <i:InvokeCommandAction Command="{Binding BackgroundColorCommand}"
                                                                   CommandParameter="{Binding ElementName=CellFillColorPicker, Path=SelectedColor, Converter={StaticResource ColorToStringConverter}}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </fluent:ColorGallery>

In addition converter is

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var color = value as Color?;
            if (color == null) return "";
            var val = color.Value;
            return $"rgba({val.R},{val.G},{val.B},{val.ScA})";
        }

Environment

  • Fluent.Ribbon v5.0.0.8
  • Windows Server 2012R2
  • .NET Framework 4.6.1
@batzen
Copy link
Member

batzen commented Mar 14, 2017

That's strange. Will have a look.

@batzen batzen self-assigned this Mar 14, 2017
@batzen batzen added this to the 6.0.0 milestone Mar 14, 2017
@batzen
Copy link
Member

batzen commented Mar 14, 2017

Ok, now i got it.
The event is fired during the property changed callback. During that time bindings to that property are not updated yet, so the command in your EventTrigger is invoked with the old value.
Will make invocation of the event async, as that's the only way to break out of the chain.

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

No branches or pull requests

2 participants