This is a migrated thread and some comments may be shown as answers.

Databinding to Visibility Property of Information Layer

4 Answers 165 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Barnes
Top achievements
Rank 1
Barnes asked on 31 Aug 2012, 10:45 AM
I am binding the visibility property of an information layer of a radmap to a boolean property in a viewmodel (via a converter). I want users to be able to show and hide the layer by checking and unchecking a checkbox.

This works when setting the boolean viewmodel property on initialization, the layer is shown or hidden based on what the property is set to. However when I subsequently change the value of the boolean viewmodel property the information layer does not show or hide.

Is the visibility of an information layer effectively a one-time only binding? I have set the binding mode to 'two-way' but it doesn't seem to make any difference.

Should I be showing or hiding the layer in some other way?

Would the functionality be different if I were using a dynamic layer?

Thanks in advance

4 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 05 Sep 2012, 08:37 AM
Hello Barnes,

It is very complicated and it is hard to reproduce the problem without your solution.
Could you, please, provide us with your runnable solution or with a small sample which reproduces it?

Greetings,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Barnes
Top achievements
Rank 1
answered on 05 Sep 2012, 09:09 AM
Hi Andrey,

I will provide you with some code snippets if that helps you to understand what I want to achieve:

ViewModel:
private bool _CanViewPins;
public bool CanViewPins
 {
     get { return _CanViewPins; }
     set
     {
         _CanViewPins = value;
         RaisePropertyChanged(() => this.CanViewPins);
     }
}
 
private ObservableCollection<Location> _DisplayPinList;
public ObservableCollection<Location> DisplayPinList
{
        get { return _DisplayPinList; }
        set
        {
                 _DisplayPinList = value;
                 RaisePropertyChanged(() => this.DisplayPinList);
        }
}


xaml:
<CheckBox Content="Show On Map" IsChecked="{Binding Path=CanViewPins, Mode=TwoWay}" >
 
<telerik:RadMap x:Name="Ir3Map"
                ZoomLevel="12"
                Center="{Binding Path=Centre, Mode=TwoWay}"
                NavigationVisibility="Visible"
                ZoomBarPresetsVisibility="Collapsed"
                telerik:StyleManager.Theme="{StaticResource MetroTheme}"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Top"
                DistanceUnit="Mile">
 
    <telerik:RadMap.Provider>
         <telerik:BingMapProvider ApplicationId="MyAppId" Mode="Road" />
     </telerik:RadMap.Provider>
 
     <telerik:InformationLayer x:Name="DisplayPinLayer"
                               ItemsSource="{Binding DisplayPinList, Mode=TwoWay}"
                               ItemTemplate="{StaticResource PinTemplate}"
                               Grid.Row="0"
                               Visibility="{Binding Path=CanViewPins, Converter={StaticResource boolToVisibilityConverter}, Mode=TwoWay}"/>
 
</telerik:RadMap>


Please let me know if this is sufficient for you to understand my issues.

Thanks

0
Accepted
Andrey
Telerik team
answered on 10 Sep 2012, 08:51 AM
Hi Thomas,

Unfortunately we can't reproduce the problem using the code snippet you sent. So, I would like to ask you to open a new formal support ticket with a small sample runnable solution attached which reproduces it.

Regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Barnes
Top achievements
Rank 1
answered on 13 Sep 2012, 11:52 AM
Hi Andrey,

It seems that in putting together a small solution for this I managed to resolve my issue. Not quite sure how I did it but reworking it got rid of the issue. I think perhaps it related to having a two-way binding on the checkbox and the information layer.

Thanks I'll mark this thread as resoved.
Tags
Map
Asked by
Barnes
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Barnes
Top achievements
Rank 1
Share this question
or