0

I'm having a Grid and in that grid m having a scroll-able content and in that having a chartgrid

Xaml Code

   <TabItem x:Name="Charts" Header="  Company Charts " TabIndex="0" IsSelected="True">
                    <ScrollViewer x:Name="ScrollViewerDN" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" Background="Transparent" telerik:StyleManager.Theme="Expression_Dark">
                        <Grid Name="OuterGridChart">
                            <Grid x:Name="ChartGrid"  Margin="10" Background="Transparent" >

CS CODE

 private void ExecuteExportSingleChartToPdf(object obj)
    {
        var values = ((System.Collections.Generic.List<object>)(obj)).ToList();
         Grid grid1 = values[0] as Grid;

above ExecuteExportSingleChartToPdf is a delegate command for a button

I'm able to generate a image temporarily bt the issue is that only the current selected tab is generated as image

  1. Wanna to have both the grid-> children (tabcontrol) -> grid
  2. access the children

And the chart grid (tabcontrol) ..charts are displayed in row and coloumn, want to have the row wise image to be saved as one.

Thewads
  • 4,953
  • 11
  • 55
  • 71
  • Please don't use all capital letters in your title... it gives the impression that you're shouting. – Sheridan Sep 16 '14 at 07:58
  • 1
    Yes i agree with Sheridan further more you should really try to make some sense . What is it your asking , how to get the content of each TabItem ? – eran otzap Sep 16 '14 at 09:02
  • sorry for this. wat i want is toh have the children of grid in grid i have following : 2 tab control, and in each tab there's again a grid In 2nd tab: of chart grid. there's row and coloumn.. i want to have the whole row to be accessed and make it a image... –  Sep 16 '14 at 09:26

1 Answers1

0

You can create an image from any Visual element (virtually all controls extend the Visual class) using just a few lines of code. Rather than repeat myself again, please refer to my answer to the How to take a screenshot of a WPF control? question to find out how to do that.

Now all you need to do is to rearrange your XAML so that you have all of your row controls in one control. Therefore, I would recommend that you define a new Grid control with however many columns that you need in your relevant Grid row... you can use the Grid.IsSharedSizeScope Attached Property to align the new Grid columns with any outer columns if need be.

Finally, just pass a reference to your new Grid to the code from the linked question and you will have an Image of your controls.

Community
  • 1
  • 1
Sheridan
  • 68,826
  • 24
  • 143
  • 183