WPF Application, Slider is missing Thumb/Thumb.Dra

2020-04-21 04:02发布

问题:

I'm following along with a tutorial on how to use a slider in a WPF application. I created a slider. The tutorial tries to tell me what to do when a slider is repositioned so it has a object

The "Thumb" attribute doesn't show up at all in the intellisense of Visual Studio and note the error when I try to set what sub fires for the Thumb.DragCompleted event: "The attachable property 'DragCompleted' was not found in type Thumb'".

In the PROPERTIES window there isn't anything talking about THUMBS or even the Slider doesn't have the DRAGCOMPLETED event showing up in the list of events when I show the slider's properties.

How do I tell visual studio that I wand the slider's thumb to use an event I've coded for the Thumb.DragCompleted event? I must be completely missing something obvious about THUMBS because I've searched for this error message and found absolutely NOTHING.

回答1:

Don't worry about the message, just type <Slider Thumb.DragCompleted="Slider_DragCompleted"/> and run. Tell if you are not able to run the code. These are known issues, in some of the cases VS gives you such design time errors. But during runtime these errors dont rise.