Click here to Skip to main content
12,758,918 members (31,283 online)
Rate this:
Please Sign up or sign in to vote.
See more: WPF
Hello friends, good afternoon, look I have a user control in which I add two circles from code (emulating a Dial) that look like this:

public partial class KnobControl : UserControl
        Canvas CnvCirculoP ;//Contiene al circulo pequeño
        Canvas CnvCirculoG; // Contiene al circulo grande

public KnobControl()

            CnvCirculoP.MouseMove += new MouseEventHandler(CircularIndicator_MouseMove);

            CnvCirculoP.MouseLeftButtonDown += new MouseButtonEventHandler(CircularIndicator_MouseLeftButtonDown);

            CnvCirculoP.MouseLeftButtonUp += new MouseButtonEventHandler(CircularIndicator_MouseLeftButtonUp);

            Dibujar ();

private void Dibujar()

The events are as follows:

void CircularIndicator_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
            this.isKnobRotating = false;

        void CircularIndicator_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            this.isKnobRotating = true;

        void CircularIndicator_MouseMove(object sender, MouseEventArgs e)
            if (this.isKnobRotating == true)
                Point p = new Point(e.GetPosition(this).X, e.GetPosition(this).Y);
                int posVal = ObtenerNuevaPosicion(p);
                _Value = posVal;

The problem is that when I use it from the main window and try to drag the small circle, nothing happens ie the "CnvCirculoP", this does not get the focus, how can I fix, please help me.
Posted 19-Dec-12 12:47pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100