RadChart Drag & Drop

2 posts, 0 answers
  1. imad
    imad avatar
    19 posts
    Member since:
    Mar 2007

    Posted 14 Oct 2009 Link to this post

    Hi,

    I am doing some sort of a designer where user can select different types of chart from a toolbox and drop it to the designer canvas.
    I am serializing the Chart dropped using XAMLWriter and making a copy of it using XAMLREADER.LOAD(), I am facing a problem with the namespace telerik that cant find the RadChart.

    Any idea on how to solve the namespace issue in loading custom types for the telerik.

    Thanks.
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 19 Oct 2009 Link to this post

    Hi imad,

    You just need to make sure you have included the correct xmlns definition in the parsed string as well ("http://schemas.telerik.com/2008/xaml/presentation"):

               RadChart chart = XamlReader.Parse(@"
    <telerik:RadChart
       xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
       xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
       xmlns:telerik=""http://schemas.telerik.com/2008/xaml/presentation"">
               <telerik:RadChart.DefaultView>
                   <telerik:ChartDefaultView >
                       <telerik:ChartDefaultView.ChartArea>
                           <telerik:ChartArea LegendName=""CustomLegend"">
                               <telerik:ChartArea.AxisX>
                                   <telerik:AxisX MajorGridLinesVisibility=""Collapsed""
                                                  Title=""XAxis Title"" />   
                                   </telerik:ChartArea.AxisX>
                               <telerik:ChartArea.AxisY>
                                   <telerik:AxisY MajorGridLinesVisibility=""Collapsed""
                                                  MinorTicksVisibility=""Visible""
                                                  Title=""YAxis Title"" />
                               </telerik:ChartArea.AxisY>
                               <telerik:ChartArea.DataSeries>
                                   <telerik:DataSeries Label=""Bar Series 1"" >
                                       <telerik:DataSeries.Definition>
                                           <telerik:BarSeriesDefinition/>
                                       </telerik:DataSeries.Definition>
                                       <telerik:DataPoint YValue=""35"" />
                                       <telerik:DataPoint YValue=""15"" />
                                       <telerik:DataPoint YValue=""55"" />
                                       <telerik:DataPoint YValue=""23"" />
                                       <telerik:DataPoint YValue=""74"" />
                                   </telerik:DataSeries>
                                   <telerik:DataSeries Label=""Bar Series 2"" >
                                       <telerik:DataSeries.Definition>
                                           <telerik:BarSeriesDefinition/>
                                       </telerik:DataSeries.Definition>
                                       <telerik:DataPoint YValue=""11"" />
                                       <telerik:DataPoint YValue=""48"" />
                                       <telerik:DataPoint YValue=""65"" />
                                       <telerik:DataPoint YValue=""41"" />
                                       <telerik:DataPoint YValue=""27"" />
                                   </telerik:DataSeries>
                                   <telerik:DataSeries Label=""Line Series"" >
                                       <telerik:DataSeries.Definition>
                                           <telerik:LineSeriesDefinition/>
                                       </telerik:DataSeries.Definition>
                                       <telerik:DataPoint YValue=""15"" />
                                       <telerik:DataPoint YValue=""5"" />
                                       <telerik:DataPoint YValue=""34"" />
                                       <telerik:DataPoint YValue=""11"" />
                                       <telerik:DataPoint YValue=""34"" />
                                   </telerik:DataSeries>
                               </telerik:ChartArea.DataSeries>
                           </telerik:ChartArea>
                       </telerik:ChartDefaultView.ChartArea>
                       <telerik:ChartDefaultView.ChartLegend>
                           <telerik:ChartLegend x:Name=""CustomLegend"" UseAutoGeneratedItems=""True"">
                               <telerik:ChartLegend.Header>Custom legend header</telerik:ChartLegend.Header>
                               <telerik:ChartLegend.Items>
                                   <telerik:ChartLegendItem Label=""Custom Legend Item"" />
                               </telerik:ChartLegend.Items>
                           </telerik:ChartLegend>
                       </telerik:ChartDefaultView.ChartLegend>
                       <telerik:ChartDefaultView.ChartTitle>
                           <telerik:ChartTitle>
                               <TextBlock Text=""Declarative RadChart""/>
                           </telerik:ChartTitle>
                       </telerik:ChartDefaultView.ChartTitle>
                   </telerik:ChartDefaultView>
               </telerik:RadChart.DefaultView>
           </telerik:RadChart>
               ") as RadChart;


    Hope this helps.


    Sincerely yours,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top