Click here to Skip to main content
15,914,013 members
Home / Discussions / WPF
   

WPF

 
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 
GeneralRe: Draging Grids in WPF Pin
sorawit amorn3-Jul-13 5:32
sorawit amorn3-Jul-13 5:32 
you will have the object to hold your grid references when you click on and the you can define MouseMove event of you canvas to set new position every time the event trigger.

I don't remember VB syntax, but on c#, It will be ...

Code
C#
 Grid mygrid;

 private MouseButtonEvent MouseLeftButtonDown(Object sender, MouseButtonEventArgs e){
    grid = sender as Grid;
    if(grid!= null){
          mygrid = grid;
    }
}

private MouseEventHandler MoveChildObject(Object sender, MouseEventHandler e){
    if(mygrid != null){
        Point p = Mouse.GetPosition(canvas);
        ControlGrid.SetValue(Canvas.TopProperty, p.Y);
        ControlGrid.SetValue(Canvas.LeftProperty, p.X);
    }
 }

private MouseButtonEvent mouseLeave(Object sender, MouseButtonEventArgs e){
     mygrid = null;
}


XMAL
XML
<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" MouseOver="MoveChildObject" >
            <Grid x:Name="ControlGrid" Width="100" Height="40" MouseLeftButtonUp="mouseLeave" MouseLeftButtonDown="MouseLeftButtonDown" >
                <Rectangle Fill="Black"/>
            </Grid>
        </Canvas>
        
    </Grid>
</Window>


NOTE :: you do not need to use grid, if you just use it for holding the rectangle. Just use rectangle object
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 

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.