Click here to Skip to main content
14,607,021 members

Silverlight / WPF

 
AnswerRe: TabControl views are not disposed Pin
Pete O'Hanlon23-Nov-16 5:30
subeditorPete O'Hanlon23-Nov-16 5:30 
PraiseRe: TabControl views are not disposed Pin
Leif Simon Goodwin23-Nov-16 21:09
mvaLeif Simon Goodwin23-Nov-16 21:09 
QuestionIs there any way to automate the silverlight application using Eclipse-testng-selenium-java frameowork Pin
Ashish khanduri20-Nov-16 18:23
MemberAshish khanduri20-Nov-16 18:23 
AnswerRe: Is there any way to automate the silverlight application using Eclipse-testng-selenium-java frameowork Pin
Mycroft Holmes20-Nov-16 19:39
professionalMycroft Holmes20-Nov-16 19:39 
GeneralRe: Is there any way to automate the silverlight application using Eclipse-testng-selenium-java frameowork Pin
Ashish khanduri20-Nov-16 19:50
MemberAshish khanduri20-Nov-16 19:50 
QuestionSound Command that can intercept the Active Thread Pin
Vimalsoft(Pty) Ltd15-Nov-16 17:56
professionalVimalsoft(Pty) Ltd15-Nov-16 17:56 
AnswerRe: Sound Command that can intercept the Active Thread Pin
Gerry Schmitz16-Nov-16 6:07
mveGerry Schmitz16-Nov-16 6:07 
QuestionCan't Move Label with mouse in WPF Pin
Dadou5512-Nov-16 22:44
MemberDadou5512-Nov-16 22:44 
I'm working on a WPF application for my company that can show the routing of cables on picture.
The Goal is to let the user choose a Part Number of a cable and the cable routing will be shown on the picture of the tool.

I will make two kinds of Access Control:

- Guest - that give only Read-Only access
- Admin - that will give the possibility to change the route on the picture (for example: adding new points, adding labels and connections between points) with Admin Panel

My problem is that i can't move the Label with the mouse, it's working with the point (the point is Path) and the Line.

Also i would like to understand why when i'm clicking on the Label it recognizes it like a TextBlock.

Here's my code:

public void Label_Edit_Mode(MouseButtonEventArgs e, Canvas canvas, bool lbledit)
        {
            if (lbledit == true)
            {
                IInputElement clickedElement = Mouse.DirectlyOver;
                if (clickedElement is TextBlock)
                {
                    label = clickedElement as TextBlock;
                    Mouse.Capture(label);
                    captured = true;
                    Vector offset = VisualTreeHelper.GetOffset(label);
                    x_label = offset.X;
                    x_canvas = e.GetPosition(canvas).X;
                    y_label = offset.Y;
                    y_canvas = e.GetPosition(canvas).Y;
                }
            }
        }

            public void Move_Points(MouseEventArgs e, Canvas canvas, bool isclicked)
        {
            if (e.LeftButton != MouseButtonState.Released)
            {
                if (captured == true && isclicked == false)
                {
                    double x = e.GetPosition(canvas).X;
                    double y = e.GetPosition(canvas).Y;
                    {
                        if (path != null)
                        {
                            x_path += x - x_canvas;
                            Canvas.SetLeft(path, x_path);
                            x_canvas = x;
                            y_path += y - y_canvas;
                            Canvas.SetTop(path, y_path);
                            y_canvas = y;
                        }

                        else if (label != null)
                        {
                            x_label += x - x_canvas;
                            Canvas.SetLeft(label, x_label);
                            x_canvas = x;
                            y_label += y - y_canvas;
                            Canvas.SetTop(label, y_label);
                            y_canvas = y;
                        }

                        else if (line != null)
                        {
                            x_line += x - x_canvas;
                            Canvas.SetLeft(line, x_line);
                            x_canvas = x;
                            y_line += y - y_canvas;
                            Canvas.SetTop(line, y_line);
                            y_canvas = y;
                        }
                    }
                }
            }
            else
            {
                captured = false;
            }
        }


here's a picture of how my application looks like:

[My App]

Thank you for your help
AnswerRe: Can't Move Label with mouse in WPF Pin
Richard Deeming14-Nov-16 2:13
mveRichard Deeming14-Nov-16 2:13 
QuestionHow to achieve grouping and ungrouping usercontrol in wpf application programmatically Pin
Pankaj Deharia10-Nov-16 3:05
professionalPankaj Deharia10-Nov-16 3:05 
AnswerRe: How to achieve grouping and ungrouping usercontrol in wpf application programmatically Pin
Gerry Schmitz10-Nov-16 7:01
mveGerry Schmitz10-Nov-16 7:01 
QuestionHow to solve the echo in a MVVM project with external data updates Pin
ronald6231-Oct-16 0:16
Memberronald6231-Oct-16 0:16 
AnswerRe: How to solve the echo in a MVVM project with external data updates Pin
Gerry Schmitz4-Nov-16 5:02
mveGerry Schmitz4-Nov-16 5:02 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
ronald624-Nov-16 5:15
Memberronald624-Nov-16 5:15 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
Gerry Schmitz4-Nov-16 5:46
mveGerry Schmitz4-Nov-16 5:46 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
ronald627-Nov-16 3:38
Memberronald627-Nov-16 3:38 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
Gerry Schmitz7-Nov-16 6:35
mveGerry Schmitz7-Nov-16 6:35 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
Pete O'Hanlon7-Nov-16 10:44
subeditorPete O'Hanlon7-Nov-16 10:44 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
Gerry Schmitz7-Nov-16 11:36
mveGerry Schmitz7-Nov-16 11:36 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
ronald629-Nov-16 0:01
Memberronald629-Nov-16 0:01 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
Gerry Schmitz10-Nov-16 12:11
mveGerry Schmitz10-Nov-16 12:11 
GeneralRe: How to solve the echo in a MVVM project with external data updates Pin
ronald6221-Nov-16 1:14
Memberronald6221-Nov-16 1:14 
QuestionPrinting an xps fixed document Pin
holdorf5-Oct-16 8:04
Memberholdorf5-Oct-16 8:04 
AnswerRe: Printing an xps fixed document Pin
holdorf5-Oct-16 9:56
Memberholdorf5-Oct-16 9:56 
QuestionCoverflow like animating grids or contentcontrol Pin
Jayme655-Oct-16 0:44
MemberJayme655-Oct-16 0:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.