HI all,
i'm creating a usercontrol, and in it i have a slider. of course, before
making the usercontrol everything exist in the top-level window1.xaml code.
No problem setting a method to respond to "valuechanged" on the slider.
now that the slider resides in the usercontrol, i'm at a loss on how to
still get the 'valuechanged' event to the top-level. any thoughts on a way
to do this do i need to implement a valuechanged method in the code-behind
for the usercontrol and then trigger some custom routed event. Hoping there
will be an easier way.
any help would be appreciate, with some sample code if possible.
make sense
Steve STerling

catching routedevent from usercontrol
RossAu42
steve
meowbaby7
If you put a Slider in the UserControl, but you want the events to bubble to the "outside world", you'll need to catch the event in your UserControl code and then re-fire it by having another event on your UserControl.
This behavior is by-design, as tha fact that you have a slider in your control is just an implementation detail. Events that happen on the inside shouldn't be exposed to the outside world unless you expose them explicitly.
Pront
----
The following code in the UserControl's code-behind works for me:
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
this.AddHandler(Slider.ValueChangedEvent, new RoutedEventHandler(delegate(object
sender, RoutedEventArgs args)
{
MessageBox.Show("got it!");
}));
}
HTH,
Drew