Click here to Skip to main content
15,889,931 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Wpf doesnt recognize my xmlns for User Control Pin
tomr126-Jun-13 17:48
tomr126-Jun-13 17:48 
AnswerRe: Wpf doesnt recognize my xmlns for User Control Pin
Abhinav S26-Jun-13 18:31
Abhinav S26-Jun-13 18:31 
GeneralRe: Wpf doesnt recognize my xmlns for User Control Pin
tomr127-Jun-13 8:20
tomr127-Jun-13 8:20 
GeneralRe: Wpf doesnt recognize my xmlns for User Control Pin
Meshack Musundi3-Jul-13 1:02
professionalMeshack Musundi3-Jul-13 1:02 
Questionwindowmediasdk for silverlight Pin
brodcasting26-Jun-13 0:24
brodcasting26-Jun-13 0:24 
QuestionDraging Grids in WPF Pin
tomr125-Jun-13 16:06
tomr125-Jun-13 16:06 
AnswerRe: Draging Grids in WPF Pin
sorawit amorn27-Jun-13 11:25
sorawit amorn27-Jun-13 11:25 
GeneralRe: Draging Grids in WPF Pin
tomr11-Jul-13 15:44
tomr11-Jul-13 15:44 
Thanks for the reply sorawit amorn. Sorry about the delay.

So I made a new project to focus on just this dragging issue. I am not great with C# but I get most of what you have there. I declared a canvas and a grid inside that canvas in the xaml code of the main window. In the behind VB code I created a loaded event handler with the initial grid positions.

Here is the Main Window code:
HTML
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Canvas x:Name="ControlCanvas" Background="AliceBlue" >
            <Grid x:Name="ControlGrid" Width="100" Height="40">
                <Rectangle Fill="Black"/>
            </Grid>
        </Canvas>
        
    </Grid>
</Window>

And here is the MainWindow.xaml.vb code:
VB
Class MainWindow 

    Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        ControlGrid.SetValue(Canvas.TopProperty, 20.0)
        ControlGrid.SetValue(Canvas.LeftProperty, 20.0)
    End Sub

    Private Sub MainWindow_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs) Handles Me.MouseLeftButtonDown
        'What do I need to do next?
    End Sub
End Class

I have no idea how to write in code what I need to do next. I need a conditional statement for when the mouse is over the grid control. Then I need to get the position of the cursor and somehow update the position of the control simultaneously. How do I do that? Thanks again.
GeneralRe: Draging Grids in WPF Pin
sorawit amorn3-Jul-13 5:32
sorawit amorn3-Jul-13 5:32 
AnswerRe: Draging Grids in WPF Pin
sorawit amorn3-Jul-13 5:33
sorawit amorn3-Jul-13 5:33 
Question[SOLVED] WPF Combobox background color Pin
Saksida Bojan22-Jun-13 7:31
Saksida Bojan22-Jun-13 7:31 
AnswerRe: WPF Combobox background color Pin
Mycroft Holmes22-Jun-13 13:43
professionalMycroft Holmes22-Jun-13 13:43 
GeneralRe: WPF Combobox background color Pin
Saksida Bojan22-Jun-13 20:43
Saksida Bojan22-Jun-13 20:43 
GeneralRe: WPF Combobox background color Pin
Mycroft Holmes22-Jun-13 21:48
professionalMycroft Holmes22-Jun-13 21:48 
GeneralRe: WPF Combobox background color Pin
Saksida Bojan22-Jun-13 23:09
Saksida Bojan22-Jun-13 23:09 
AnswerRe: WPF Combobox background color Pin
Abhinav S22-Jun-13 18:36
Abhinav S22-Jun-13 18:36 
GeneralRe: WPF Combobox background color Pin
Saksida Bojan22-Jun-13 20:46
Saksida Bojan22-Jun-13 20:46 
GeneralRe: WPF Combobox background color Pin
Abhinav S23-Jun-13 17:29
Abhinav S23-Jun-13 17:29 
QuestionCan attached behaviors have knowledge of ViewModels? Pin
sthotakura21-Jun-13 6:29
sthotakura21-Jun-13 6:29 
AnswerRe: Can attached behaviors have knowledge of ViewModels? Pin
Abhinav S22-Jun-13 18:32
Abhinav S22-Jun-13 18:32 
GeneralRe: Can attached behaviors have knowledge of ViewModels? Pin
sthotakura25-Jun-13 3:47
sthotakura25-Jun-13 3:47 
QuestionButton disables when bind command Pin
maxRazar20-Jun-13 18:27
maxRazar20-Jun-13 18:27 
AnswerRe: Button disables when bind command Pin
Pete O'Hanlon20-Jun-13 20:21
mvePete O'Hanlon20-Jun-13 20:21 
QuestionError in Wpf Pin
Nick_Frenk16-Jun-13 21:57
Nick_Frenk16-Jun-13 21:57 
AnswerRe: Error in Wpf Pin
Pete O'Hanlon16-Jun-13 23:20
mvePete O'Hanlon16-Jun-13 23:20 

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.