Databinding to Visibility Property of Information Layer

5 posts, 1 answers
  1. Barnes
    Barnes avatar
    17 posts
    Member since:
    May 2012

    Posted 31 Aug 2012 Link to this post

    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
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 05 Sep 2012 Link to this post

    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.

  3. DevCraft banner
  4. Barnes
    Barnes avatar
    17 posts
    Member since:
    May 2012

    Posted 05 Sep 2012 Link to this post

    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

  5. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 10 Sep 2012 Link to this post

    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.

  6. Barnes
    Barnes avatar
    17 posts
    Member since:
    May 2012

    Posted 13 Sep 2012 Link to this post

    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.
Back to Top
DevCraft banner