Declined
Last Updated: 08 Oct 2014 14:34 by ADMIN
Alexi
Created on: 02 Oct 2014 21:19
Category: ListBox
Type: Bug Report
0
Error binding visualizationlayer to itemssource listbox
Currently I´m testing the latest versión of Telerik Silverlight and the RadListBox control is crashing when binding VisualizationLayer items from RadMap control. It doesn´t show error information, the screen is withe.
This is the code I´m using:

VIEW

 <Grid>
  <Grid.Resources>
    <converters:ItemsMapToLayerStringConverter  x:Key="ItemsMapToLayerStringConverter" />
  </Grid.Resources>
  <Grid.RowDefinitions>
    <RowDefinition Height="*"/>
    <RowDefinition Height="Auto"/>
  </Grid.RowDefinitions>
  <telerik:RadMap x:Name="Map">
    <telerik:RadMap.Providers>
      <telerik:OpenStreetMapProvider />
    </telerik:RadMap.Providers>
  </telerik:RadMap>
  <telerik:RadListBox ItemsSource="{Binding ElementName=Map, Path=Items, Converter={StaticResource ItemsMapToLayerStringConverter}}" Gid.Row="1" >
    <telerik:RadListBox.ItemTemplate>
      <DataTemplate>
        <TextBlock Text="{Binding Tag}"/>
      </DataTemplate>
    </telerik:RadListBox.ItemTemplate>
  </telerik:RadListBox>
</Grid>

CONVERTER.

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
  var mapa = value as RadMap;
  var capas = mapa.ChildrenOfType<VisualizationLayer>().ToList();
  return capas;
}
1 comment
ADMIN
Yana
Posted on: 08 Oct 2014 14:34
The code inside the converter does not seem correct - you're binding to the Items property of the RadMap, but in the converter try to cast it to the Map itself. 

There is no need to have a converter actually, the binding should work directly:
 <telerik:RadListBox ItemsSource="{Binding ElementName=Map, Path=Items}" ...>
as the Items of the RadMap are the VisualizationLayers.

If you still experience the issue, please send us a support ticket with more details on the exact requirement.