xaml - passing property of Control as CommandParameter

PhilipOGormanPhilipOGorman USMember ✭✭✭

I want to pass a property of the Control MapView as a CommandParameter. I can pass the whole control as a parameter by using x:Name, but how can I pass one of its properties?

<esriUI:MapView x:Name="MyMapView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Map="{Binding RendererManager.Map}" GraphicsOverlays="{Binding RendererManager.GraphicsOverlays}" local:CommandBinder.RequestView="{Binding RendererManager.ViewpointRequested}"> <b:Interaction.Behaviors> <b:BehaviorCollection> <b:EventToCommand EventName="ViewpointChanged" Command="{Binding ViewpointChanged}" CommandParameter="{x:Reference MyMapView}" /> </b:BehaviorCollection> </b:Interaction.Behaviors> </esriUI:MapView>

Best Answer

Answers

  • PhilipOGormanPhilipOGorman USMember ✭✭✭

    @NMackay Thanks!

    <esriUI:MapView x:Name="MyMapView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Map="{Binding RendererManager.Map}" GraphicsOverlays="{Binding RendererManager.GraphicsOverlays}" local:CommandBinder.RequestView="{Binding RendererManager.ViewpointRequested}"> <b:Interaction.Behaviors> <b:BehaviorCollection> <b:EventToCommand EventName="ViewpointChanged" Command="{Binding ViewpointChanged}" CommandParameter="{Binding Source={x:Reference MyMapView}, Path=VisibleArea.Extent}" /> </b:BehaviorCollection> </b:Interaction.Behaviors> </esriUI:MapView>

  • NMackayNMackay GBInsider, University mod
Sign In or Register to comment.