我的XAML看起來像這樣:如何獲取ControlTemplate元素的屬性?
<charting:Chart
Name="pieSeries1">
<charting:PieSeries
IndependentValuePath="Category" DependentValuePath="Amount"
Palette="{StaticResource MyPalette}">
</charting:PieSeries>
<charting:Chart.Template>
<ControlTemplate TargetType="charting:Chart">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<datavis:Title Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" Margin="1"/>
<Grid Grid.Row="1" Margin="5,0,5,0">
<chartingPrmtvs:EdgePanel x:Name="ChartArea" MinHeight="200" Style="{TemplateBinding ChartAreaStyle}">
<Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
<Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
</chartingPrmtvs:EdgePanel>
</Grid>
<datavis:Legend VerticalAlignment="Top" Grid.Row="2" Header="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" x:Name="Legend"/>
</Grid>
</ControlTemplate>
</charting:Chart.Template>
</charting:Chart>
我怎樣才能得到的ChartArea
的高度?快速查看顯示pieSeries1.ChartArea
的值,但該運行時不可用。我也試過FindName
但沒有結果。
應該是相當容易的權利?
你在哪裏試圖獲得價值?在代碼隱藏或在您的XAML? –
在代碼後面 – 321X