GridViewToggleRowDetailsColumn content(DATATEMPLATE) as RADCHART.)

5 posts, 1 answers
  1. Karthikeyan
    Karthikeyan avatar
    27 posts
    Member since:
    Aug 2011

    Posted 15 Sep 2011 Link to this post

    Hi,

    I'm facing some issues in "GridViewToggleRowDetailsColumn" datatemplate as seprate UserControl which has RADCHART.

    1. I'm having a GridView in a usercontrol as follows(MainPage.XAML),
      <telerik:RadGridView HorizontalAlignment="Left" Name="radGridView1" Grid.Column="1" Visibility="Collapsed" IsReadOnly="True" 
                                 VerticalAlignment="Top" Width="Auto" AutoGenerateColumns="True" LoadingRowDetails="radGridView1_LoadingRowDetails">
    2. I'm creating the column dynamically, includes GridViewToggleRowDetailsColumn.
    3. I'm having another usercontrol as RADCHART as follows(ChartPage.XAML),
    <telerik:RadChart Height="300" ItemsSource="{Binding chartDetails}" HorizontalAlignment="Center" Name="radChart1" VerticalAlignment="Center" Width="400">
                <telerik:RadChart.DefaultSeriesDefinition>
                    <telerik:BarSeriesDefinition />
                </telerik:RadChart.DefaultSeriesDefinition>
         </telerik:RadChart>

    4. On expanding the GridViewToggleRowDetailsColumn , it has to load the Rad chart with data. as follows,
    <telerik:RadGridView.RowDetailsTemplate>
                        <DataTemplate>
                            <local:Chart
    Page x:Name="MyChart1"/>
                        </DataTemplate>
          </telerik:RadGridView.RowDetailsTemplate>

        But its not loading the chart, mean EMPTY chart only visible on expansion.
    5. In "ChartPage.XAML", I'm having a public method with parameters as follows,
    public void Get2DChart(string param1, string param2, string param2)
            {
               //WEB SERVICE CALL
            }

    6. So I want to call this method from my "MainPage.XAML" in the event of "radGridView1_LoadingRowDetails" as follows,
    private void radGridView1_LoadingRowDetails(object sender, Telerik.Windows.Controls.GridView.GridViewRowDetailsEventArgs e)
            {
                Chart
    Page obj2D = new ChartPage();
                obj2D.Get2DChart(
    param1, param2, param3);
            }

    7. If I call the above mentioned method, its doesnt showing the chart as expected. It shows only empty chart.
    8. But If I'm executing the "ChartPage.XAML", It's showing with Datas as Expected.


    Please guide me to bring the chart output.
    I'm STRUCKED badely, as I'm new to TELERIK.
    Please find the output page of my chart.
    I would greatly appreciated/Thankful even a small tip.

    Thanks,
    Karthikeyan Manickam
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Sep 2011 Link to this post

    Hi Karthikeyan,

    The DataContext of RowDetails is the corresponding item. So, you need to make sure that this item has a property -  charDetails. Otherwise, the chart will not be able to find where to get its data. The other approach would be to explicitly define the Source property of the ItemsSource binding.


    All the best,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Karthikeyan
    Karthikeyan avatar
    27 posts
    Member since:
    Aug 2011

    Posted 15 Sep 2011 Link to this post

    Hi Maya,

    Thanks for your support.

    Could you please elaborate with me the sample code.
    Because the "ChartDetails" has binded to Itemsource of my "ChartPage.xaml" in code behind.
    Sorry I'm not clear, the mentioned datacontext for which control.
    Please guide me or correct me if I misunderstood.

    Thanks,
    Karthikeyan Manickam.
  4. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 16 Sep 2011 Link to this post

    Hello Karthikeyan,

    Please take a look at our online documentation and demos for a reference on how to work with RowDetails.
    The DataContext of the control defined inside RowDetails is the corresponding item. 

     

    All the best,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Karthikeyan
    Karthikeyan avatar
    27 posts
    Member since:
    Aug 2011

    Posted 18 Sep 2011 Link to this post

    Hi Maya,

    You're AWESOME.
    I fixed my issue, Thanks for your Quick and Continuous Support.

    (Fix For Reference....)
     ChartPage objCP = e.DetailsElement as ChartPage ;
     objCP.Get2DChart(param1, param2, param3);
     e.DetailsElement.DataContext = objCP.chartDetails;

    TELERIK ROCKZZZ....!!!

    Cheers...
    Karthikeyan Manickam.
Back to Top