Map interaction client/Layer visibility

From Maria GDK Wiki
Jump to navigation Jump to search

The visibility of each layer is controlled individually through each layers Visibility property, IMariaInternalLayer.Visible.

To select layers to be displayed, first add a layers property to the main view model (MariaWindowViewModel):

public ObservableCollection<IMariaLayer> LayersDisplay
{
    get { return new ObservableCollection<IMariaLayer>(Layers);}
}

Then, add a list box with check items your XAML:

<ListBox Name="lstLayers" Height="Auto" Margin="2" 
             ItemsSource="{Binding LayersDisplay}" >
    <ListBox.ItemTemplate>
        <DataTemplate>
            <CheckBox Width="Auto" 
                      Content="{Binding Path=Name}" 
                      IsChecked="{Binding Path=Visible, Mode=TwoWay}" >
            </CheckBox>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Running your application, you should be able to turn the different layers on/off !

Layer visibility