Skip to main content
Home Forums Silverlight Programming Programming with .NET - General How to find control in chart template in code.
3 replies. Latest Post by raj.jadhav on July 13, 2009.
(0)
mahendra...
Member
136 points
158 Posts
05-30-2009 5:43 AM |
Hi,
I hve template in chart. I need to find Grid row in code behind which is present in template.
My code is as below
<chart:Chart.Template> <ControlTemplate TargetType="chart:Chart"> <Grid> <Grid.RowDefinitions> <RowDefinition x:Name="rowChartArea"/>
</Grid.RowDefinitions>
<Grid x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" Grid.Row="0"> <Grid x:Name="PlotArea" Style="{TemplateBinding PlotAreaStyle}">
<Grid x:Name="GridLinesContainer" Background="White" />
<Grid x:Name="SeriesContainer" />
</Grid> </Grid>
</Grid> </ControlTemplate> </chart:Chart.Template>I want to set height of rowChartArea from codeso how can i do that.
Thanks,
Mahendra
Amanda W...
All-Star
17241 points
1,466 Posts
06-04-2009 5:24 AM |
Hi Mahendra,
You can get the Gird object that is in the Chart's tempate by using silverlight's VisualTreeHelper that is used to traverse the object relationships (along child object or parent object axes) in the Silverlight visual tree.
The more about the VisualTreeHelper, you can try to check this msdn link: http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper(VS.95).aspx
06-04-2009 6:09 AM |
Thanks for reply...Can u plz give sample code for the same?
Regards,
Mahendra..
raj.jadhav
54 points
107 Posts
07-13-2009 5:33 AM |
HI,
I need same functionality. I have template in chart control as below
Here i set row height as 200 for grid row. I need to set ot from code.So how can i find row in code behind. Also want to find controls in grid.
So please give sample code for that.
Thanks in advance,
Rajesh