4

I have XAML code:

<Ellipse x:Name="node" Height="10" Width="10" map:MapCanvas.Latitude="{Binding Latitude}" map:MapCanvas.Longitude="{Binding Longitude}" Fill="Red" Stroke="Red" StrokeThickness="1" Stretch="Uniform" </Ellipse> 

and this

xmlns:map="clr-namespace:MapControl;assembly=MapControl" 

here is the dependency property in MapCanvas class:

 public static readonly DependencyProperty LatitudeProperty = DependencyProperty.RegisterAttached("Latitude", typeof(double), typeof(MapCanvas), new PropertyMetadata(double.PositiveInfinity, OnLatitudeLongitudePropertyChanged)); public static readonly DependencyProperty LongitudeProperty = DependencyProperty.RegisterAttached("Longitude", typeof(double), typeof(MapCanvas), new PropertyMetadata(double.PositiveInfinity, OnLatitudeLongitudePropertyChanged)); 

I know there was similar questions but my question is how can I do bining in code behind same like in XAML code for longitude and latitude?

1 Answer 1

1
node.SetBinding(MapCanvas.LatitudeProperty, new Binding("Latitude")); 

You can Bind like this..

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.