This is a migrated thread and some comments may be shown as answers.

RadChart Drag & Drop

1 Answer 35 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
imad
Top achievements
Rank 1
imad asked on 14 Oct 2009, 09:41 AM
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.

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 19 Oct 2009, 03:40 PM
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.
Tags
General Discussions
Asked by
imad
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or