Link to home
Start Free TrialLog in
Avatar of Mr_Javed
Mr_Javed

asked on

Change the location of control at runtime in WPF application.

How to change the location (left and top) of the image control in wpf windows application at runtime?
ASKER CERTIFIED SOLUTION
Avatar of BitRunner303
BitRunner303

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_Javed
Mr_Javed

ASKER

Thanks for the reply.

When I created the sample like yours. in VB

==============================================================
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
        TextBox1.SetValue(Canvas.LeftProperty, 10)
    End Sub
==============================================================

This give me the error : '10' is not a valid value for property 'Left'.
When I changed the value 10 to any other, the same error I'm getting.

What can be the problem?




That error is solved now. that was because I pass 10, that is integer value and it requires double value.

your solution works. Thanks BitRunner303

Thanks a lot