Telerik Forums
UI for WPF Forum
1 answer
22 views

Hello,

In our app we are using filtering through a RadGridView bound to a QueryableCollectionView that wraps an ObservableCollection. Now I'm trying to use that filtered QueryableCollectionView as the ItemSource for a VisualizationLayer in a RadMap so that the filter on the grid also applies to items shown on the map, but the bind fails with the following error: "System.ArgumentException: 'Telerik.Windows.Data.QueryableCollectionView' is not a valid value for property 'Source'."

I've attached a quick project replicating the issue with the relevant code in MainWindow.xaml:

            <!-- Doesn't work -->
            <telerik:VisualizationLayer ItemsSource="{Binding ItemViewModelsView }" ItemSelectionMode="None">
                <telerik:VisualizationLayer.ItemTemplate>
                    <DataTemplate DataType="{x:Type local:ItemViewModel}">
                        <Ellipse Fill="Blue" Width="12" Height="12" telerik:MapLayer.Location="{Binding Location}"/>
                    </DataTemplate>
                </telerik:VisualizationLayer.ItemTemplate>
            </telerik:VisualizationLayer>
            
            <!-- Also doesn't work pulling directly from the GridView -->
            <telerik:VisualizationLayer ItemsSource="{Binding Items, ElementName=GridView }" ItemSelectionMode="None">
                <telerik:VisualizationLayer.ItemTemplate>
                    <DataTemplate DataType="{x:Type local:ItemViewModel}">
                        <Ellipse Fill="Blue" Width="12" Height="12" telerik:MapLayer.Location="{Binding Location}"/>
                    </DataTemplate>
                </telerik:VisualizationLayer.ItemTemplate>
            </telerik:VisualizationLayer>
            
            <!-- Works but isn't filtered -->
            <telerik:VisualizationLayer ItemsSource="{Binding ItemViewModels }" ItemSelectionMode="None">
                <telerik:VisualizationLayer.ItemTemplate>
                    <DataTemplate DataType="{x:Type local:ItemViewModel}">
                        <Ellipse Fill="Blue" Width="12" Height="12" telerik:MapLayer.Location="{Binding Location}"/>
                    </DataTemplate>
                </telerik:VisualizationLayer.ItemTemplate>
            </telerik:VisualizationLayer>

and the ViewModel:

public partial class MainWindowViewModel : ObservableObject
{
    [ObservableProperty] private ObservableCollection<ItemViewModel> _itemViewModels;
    public QueryableCollectionView ItemViewModelsView { get; private set; }
//...
}

It appears to me that the issue is because QueryableCollectionView is both an IEnumerable and a ICollectionView so when it tries to assign it to the MapItemsSource the CollectionViewSource.IsSourceValid() that's called during that assignment is returning false because it is an ICollectionView.

Is there a known workaround for this or suggested alternative to get the expected functionality?

Thanks!

Petar Mladenov
Telerik team
 answered on 26 Mar 2025
1 answer
24 views

Hi,

I am working on a tool for an application based on one of the examples. I have noticed that when I create the pushpin using a Path then it is only selected if I hit exactly on the lines of the image being drawn.

This could be a general XAML question, but not really sure how this works. I would like to have the pin selected when I hit the area defined by the image.

My datatemplate:

            <DataTemplate x:Key="PositionPushPinTemplate">
                <Grid telerik:MapLayer.Location="{Binding Location}"
                      telerik:RadToolTipService.PlacementRectangle="-38 0 0 0"
                      telerik:RadToolTipService.Placement="Top"
                      telerik:RadToolTipService.ToolTipContent="{Binding}"
                      telerik:RadToolTipService.ToolTipContentTemplate="{StaticResource LocationLabelTemplate}"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Top">
                    <Path Canvas.Top="2.989" Canvas.Left="3.188" 
                          Data="{Binding Icon}" 
                          Stretch="Uniform" 
                          Fill="{Binding Color}" 
                          Width="26" 
                          Height="26" 
                          Margin="0,0,0,0" 
                          RenderTransformOrigin="0.5,0.5">
                        <Path.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <RotateTransform Angle="0" />
                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Path.RenderTransform>
                    </Path>
                </Grid>
            </DataTemplate>
hhgm
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 21 Feb 2025
0 answers
35 views

hello 

i have customprovider base on UriImageProvider.

When I lose my network connectionand I try to move the map quickly or zoom in or out, the program breaks and my visual studio go to getemptyimage located in class imagemapsource.

What I'm doing wrong or how to protect myself from it?

 

Sebastian
Top achievements
Rank 1
 asked on 09 Sep 2024
1 answer
72 views

Is there a reason the ArcGIS provider does not require a key? Following the documentation shows the map without any issues.

https://docs.telerik.com/devtools/wpf/controls/radmap/features/providers/arcgis

Also, is there a way to use other styles or basemaps other than what the control provides? In particular, the imagery hybrid, which is aerial imagery with the roads/labels.

Is it possible to change the max zoom? ArcGisWorldMapSourceBase.cs uses a max zoom of only 19. I have the same issue with the Bing and Azure providers. I'd like to use the higher zoom levels available and not have the map control scale the images, which will then be blurry.

Martin Ivanov
Telerik team
 answered on 12 Aug 2024
0 answers
62 views

Hello ,

I'm currently working on a visualization layer to display a trace line of a Location Collection. To achieve this, I have set the ItemsSource of the layer to an Observable Collection. Additionally, I am using PolylineData to visualize the Location Collection. However, during implementation, I encountered the following errors:

  • The specified value cannot be assigned. The following type was expected: "DependencyObject".
  • Property 'VisualTree' does not support values of type 'PolylineData'.

Here is the code portion 

                                <telerik:VisualizationLayer x:Name="visualizationLayer" ItemsSource="{Binding ObJItems}">
                                    <telerik:VisualizationLayer.ItemTemplate>
                                        <DataTemplate>
                                            <telerik:PolylineData Points="{Binding TrackPoints}">
                                        <telerik:PolylineData.ShapeFill>
                                            <telerik:MapShapeFill Stroke="Blue" 
                                      StrokeThickness="2" />
                                        </telerik:PolylineData.ShapeFill>
                                    </telerik:PolylineData>
                                        </DataTemplate>
                                    </telerik:VisualizationLayer.ItemTemplate>
                                </telerik:VisualizationLayer>


BNM2024
Top achievements
Rank 1
Iron
 asked on 11 Mar 2024
2 answers
132 views

Hello, 

I'm currently working on a visualization layer to display a trace line of a Location Collection. To achieve this, I have set the ItemsSource of the layer to an Observable Collection. Additionally, I am using PolylineData to visualize the Location Collection. However, during implementation, I encountered some errors.

  • The specified value cannot be assigned. The following type was expected: "DependencyObject".
  • Property 'VisualTree' does not support values of type 'PolylineData'.

Here is the portion of the code

<telerik:VisualizationLayer x:Name="visualizationLayer" ItemsSource="{Binding ObjItems}">
                                    <telerik:VisualizationLayer.ItemTemplate>
                                        <DataTemplate>
                                            <telerik:PolylineData Points="{Binding TrackPoints}">
                                        <telerik:PolylineData.ShapeFill>
                                            <telerik:MapShapeFill Stroke="Blue" 
                                      StrokeThickness="2" />
                                        </telerik:PolylineData.ShapeFill>
                                    </telerik:PolylineData>
                                        </DataTemplate>
                                    </telerik:VisualizationLayer.ItemTemplate>
                                </telerik:VisualizationLayer

BNM2024
Top achievements
Rank 1
Iron
 answered on 11 Mar 2024
1 answer
105 views

Hello. I faced the problem when i am trying to get Route from BinRestMapProvider, using method CalculateRouteAsync, it returns status code 400 and message like this: "This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","errorDetails":["One or more parameters are not valid.","waypoint: One or more locations specified in the waypoint parameter are invalid or require more information. : 42,6957539183824;23,3327663758679"],"resourceSets":[],"statusCode":400,"statusDescription":"Bad Request" "

I just followed the example at:
https://docs.telerik.com/devtools/wpf/controls/radmap/features/providers/bing-rest-map-provider/routing

I guess problem is in example 4 of this doc: "request.Waypoints.Add(point.ToString());"

I hope someone can help me with it.

Dmytro
Top achievements
Rank 1
Iron
 answered on 09 Jun 2023
2 answers
116 views

I have a MapPinPoint, and I want to insert it inside an Ellipse dynamically

How can this be done?

Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
 answered on 08 Jan 2023
2 answers
105 views

var frameworkElements = KmlReader.Read(memoryStream);

I have a list of the elements (which in the initial stage are not displayed on the map) and I want to have a BusyIndicator until loading.

That is, until I performed the KmlReader.Read(memoryStream), the list in the picture will be a square without data, so I want a BusyIndicator

But the KmlReader works on the UI thread, so this cannot be done.

Is there a way to overcome this?

Is there a way to make this line in the background thread?

 

Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
 updated answer on 26 Dec 2022
0 answers
89 views

How to compare two MapPinPoint

MapPinPoint mapPinPoint1 = new MapPinPoint();
MapPinPoint mapPinPoint2 = new MapPinPoint();

How can you check if they are equal?

Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
 asked on 22 Dec 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?