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 event raised before SelectedColor changed #398

Closed
User3290 opened this issue Feb 14, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@User3290
Copy link

User3290 commented Feb 14, 2017

Our case is

<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 SetBackgroundColorCommand}"
                                                                   CommandParameter="{Binding ElementName=CellFillColorPicker, Path=SelectedColor}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </fluent:ColorGallery>

In sources we can see next

private static void OnSelectedColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
      ColorGallery colorGallery = d as ColorGallery;
      if (colorGallery == null)
        return;
      colorGallery.RaiseEvent(new RoutedEventArgs(ColorGallery.SelectedColorChangedEvent));
      Color? color = (Color?) e.NewValue;
      colorGallery.UpdateSelectedColor(color);
    }

Why do we have so strange logic?
I have received an old value of color in the handler of specified command in XAML!


Environment

  • Fluent.Ribbon v4.0.3.394
  • Theme Office2013 (Component/Themes/Office2013/Generic.xaml)
  • Windows Server 2012R2
  • .NET Framework 4.6.1
@batzen
Copy link
Member

batzen commented Feb 15, 2017

Looks like an oversight.
No need to use exclamation marks...

@batzen batzen added this to the 5.0.0 milestone Feb 18, 2017
@batzen batzen self-assigned this Feb 18, 2017
@batzen batzen closed this as completed in aafd05d Feb 18, 2017
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