Click here to Skip to main content
15,913,939 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: What is the use of somefile.g.i.cs auto-generated file in Wpf? Pin
Richard MacCutchan3-Jul-13 22:29
mveRichard MacCutchan3-Jul-13 22:29 
AnswerRe: What is the use of somefile.g.i.cs auto-generated file in Wpf? Pin
AlphaDeltaTheta4-Jul-13 20:37
AlphaDeltaTheta4-Jul-13 20:37 
GeneralRe: What is the use of somefile.g.i.cs auto-generated file in Wpf? Pin
Mohammed Hameed4-Jul-13 21:03
professionalMohammed Hameed4-Jul-13 21:03 
QuestionCode first or Database First Pin
Hossein Khalaj3-Jul-13 18:50
Hossein Khalaj3-Jul-13 18:50 
AnswerRe: Code first or Database First Pin
Mycroft Holmes3-Jul-13 19:43
professionalMycroft Holmes3-Jul-13 19:43 
Questionspeed up Silverlight project Pin
Member 91093872-Jul-13 23:15
Member 91093872-Jul-13 23:15 
AnswerRe: speed up Silverlight project Pin
Pete O'Hanlon2-Jul-13 23:28
mvePete O'Hanlon2-Jul-13 23:28 
Questioncan we get audio buffer in mediaelement. Pin
brodcasting2-Jul-13 0:50
brodcasting2-Jul-13 0:50 
QuestionDrawing Lines Dynamically Pin
velkumar_in30-Jun-13 23:44
velkumar_in30-Jun-13 23:44 
QuestionRe: Drawing Lines Dynamically Pin
Kenneth Haugland5-Jul-13 14:05
mvaKenneth Haugland5-Jul-13 14:05 
QuestionGridView click to load data Pin
maxRazar27-Jun-13 22:00
maxRazar27-Jun-13 22:00 
Questionhow to get audiometer level in mediaelement Pin
brodcasting27-Jun-13 19:13
brodcasting27-Jun-13 19:13 
QuestionRe: how to get audiometer level in mediaelement Pin
Kenneth Haugland5-Jul-13 14:06
mvaKenneth Haugland5-Jul-13 14:06 
Questiondatagrid columns, ExpandoObject question Pin
BoydMills27-Jun-13 9:07
BoydMills27-Jun-13 9:07 
QuestionWpf doesnt recognize my xmlns for User Control Pin
tomr126-Jun-13 11:31
tomr126-Jun-13 11:31 
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 

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.