<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Thumb_wcp.Pane1"> <StackPanel> <Thumb Name="myThumb" Background="Blue" Width="20" Height="20" DragStarted="onDragStarted" DragCompleted="onDragCompleted"/> </StackPanel> </Canvas> //File:Window.xaml.cs using System; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Documents; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Data; using System.Windows.Media; namespace Thumb_wcp { public partial class Pane1 : Canvas { void onDragStarted(object sender, DragStartedEventArgs e) { myThumb.Background = Brushes.Orange; } void onDragCompleted(object sender, DragCompletedEventArgs e) { myThumb.Background = Brushes.Blue; } } }