You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ColorPicker doesn't triger color Change event after color change from UI #1631
You are right, it is only triggered if the color property is changed outside of the color picker.
@Keboo this is because if you change to color in the color picker, first the HsbPropertyChangedCallback is called, which sets _inCallback to true, but the ColorPropertyChangedCallback which fires the ColorChanged event then returns early because of this field beeing true.
I seem to have overlooked that when making my PR (or something changed in between).
I can make a PR to fix this and firing the event even if _inCallback istrue (it should not get called multiple times, right?)
I think multiple times - on every change not on Mouse Up.
I made workaround in my app to have this behavior and it works great.
I call color getter on MouseMove Event. Mouse Move is called only when Mouse Left button and it suits me :) I am getting live upodate.
...
ColorPicker.MouseMove += ColorPicker_MouseMove;
}
// ...
private void ColorPicker_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
var items = ColorsList.Items;
ColorItem item;
for (int i = 0; i < items.Count; ++i)
{
item = (ColorItem)items[i];
if (item.IsSelected)
{
item.Color = ColorPicker.Color;
}
}
}
@Keboo When I add raising event to every time the hsb value change callback is called the color tool get's very laggy. Do you have any idea how this could be done better? Maybe not using a routed event could improve it?
Activity
Mrxx99 commentedon Feb 1, 2020
You are right, it is only triggered if the color property is changed outside of the color picker.
@Keboo this is because if you change to color in the color picker, first the
HsbPropertyChangedCallbackis called, which sets_inCallbacktotrue, but theColorPropertyChangedCallbackwhich fires theColorChangedevent then returns early because of this field beeingtrue.I seem to have overlooked that when making my PR (or something changed in between).
I can make a PR to fix this and firing the event even if
_inCallbackistrue(it should not get called multiple times, right?)flamaniac commentedon Feb 1, 2020
I think multiple times - on every change not on Mouse Up.

I made workaround in my app to have this behavior and it works great.
I call color getter on MouseMove Event. Mouse Move is called only when Mouse Left button and it suits me :) I am getting live upodate.
Mrxx99 commentedon Feb 1, 2020
If you use binding you can also use the setter of the property bound to the Color property of the ColorPicker (that's how it is done in the Demo App)
Mrxx99 commentedon Feb 28, 2020
@Keboo When I add raising event to every time the hsb value change callback is called the color tool get's very laggy. Do you have any idea how this could be done better? Maybe not using a routed event could improve it?
#1631: ColorPicker doesn't triger color Change event after color chan…
Merge pull request #102 from MaterialDesignInXAML/master