Using RadCharts on a dynamic layer

3 posts, 1 answers
  1. Simon
    Simon avatar
    34 posts
    Member since:
    Oct 2010

    Posted 16 Nov 2010 Link to this post

    Hi,

    I have defined a dynamic layer, and I am trying to deliver up RadCharts.  As per your examples, I set the MapLayer Location Property on the RadChart.

    If I add the charts directly to an InformationLayer, then they work
    If I add them on the dynamic layer I get the following exception

    Specified index is out of range or child at index is null. Do not call this method if VisualChildrenCount returns zero, indicating that the Visual has no children.\r\nParameter name: index\r\nActual value was 0.

       at System.Windows.FrameworkElement.GetVisualChild(Int32 index)\r\n   at System.Windows.Media.Visual.InternalGet2DOr3DVisualChild(Int32 index)\r\n   at System.Windows.Media.VisualTreeHelper.GetChild(DependencyObject reference, Int32 childIndex)\r\n   at Telerik.Windows.Controls.RadChart.PopulateLogicalChildren()\r\n   at Telerik.Windows.Controls.RadChart.OnApplyTemplate()\r\n   at Telerik.Windows.Controls.Map.DynamicLayer.MapSquares.CheckVisibility()\r\n   at Telerik.Windows.Controls.Map.DynamicLayer.RequestSlices(Int32 matrixIndex)\r\n   at Telerik.Windows.Controls.Map.DynamicLayer.ProcessRequests()

    Is there something that I am not doing properly.

    Thanks
    Simon
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 18 Nov 2010 Link to this post

    Hi Simon,

    Thank you for the feedback.
    There is a peculiarity of using RadChart with DynamicLayer. You should add it to a simple container like Grid.
    RadChart chart = new RadChart();
    // chart initialization
    // ...

    Grid grid =
    new Grid();
    grid.Children.Add(chart);

    Location location =
    new Location(42.866667, 25.333333);
    MapLayer.SetLocation(grid, location);

    Then by items request you can use this Grid element instead of RadChart.

    All the best,
    Andrey Murzov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  3. UI for WPF is Visual Studio 2017 Ready
  4. Simon
    Simon avatar
    34 posts
    Member since:
    Oct 2010

    Posted 19 Nov 2010 Link to this post

    Thanks, in the end I created a new control that contained a RadMap and that works just fine
Back to Top