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

GridViewToggleRowDetailsColumn content(DATATEMPLATE) as RADCHART.)

4 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karthikeyan
Top achievements
Rank 1
Karthikeyan asked on 15 Sep 2011, 07:32 AM
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

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 15 Sep 2011, 10:19 AM
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 >>

0
Karthikeyan
Top achievements
Rank 1
answered on 16 Sep 2011, 02:21 AM
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.
0
Accepted
Maya
Telerik team
answered on 16 Sep 2011, 02:50 PM
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 >>

0
Karthikeyan
Top achievements
Rank 1
answered on 19 Sep 2011, 03:00 AM
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.
Tags
GridView
Asked by
Karthikeyan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Karthikeyan
Top achievements
Rank 1
Share this question
or