Hi. I'd like to fire a SelectionChangedEvent. What I have is this:
Fluent.ComboBox fcb = elt as Fluent.ComboBox;
fcb.RaiseEvent(
new SelectionChangedEventArgs(
null,
new List<double>() { (double)fcb.SelectedItem },
new List<double>() { fontSize })
);
My question is what I have to insert for the null parameter. The constructor expects a RoutedEvent. What do I use there, and will the list parameters be ok for the constructor?
Ok, my assumptions were wrong, the DP-Callbacks are not bypassed, but there's another problem.
Here is the context I'm using this approach in, maybe you can show me a better way to solve this problem:
What I want to do is create an Office-like Combobox for choosing a FontFamily/FontSize. The user should be able to select a size from the combobox by mouse but also by typing in a value. That's why I already handle the Enter-event via this: http://stackoverflow.com/questions/563195/wpf-textbox-databind-on-enterkey-press/564659#564659 I got this working, whenever I type in a value it changes the Font.
What I want to do is to map the Enter-Event with a SelectionChangedEvent, so all I got to do is pass the CurrentText value (which is typed in by the user) to the SelectionChangedEventHandler, which is hopefully handled by the DependencyProperty. I got this working so far. But when I
fcb.SelectedItem = fcb.CurrentText;
Exceptions get thrown in the console. This isn't that dramatical, since the application still works. However, I'd like to handle these exceptions in the ValidateCallback of the DP, which is called after I assign CurrentText to SelectedItem. Is there no way to catch these exceptions later on?