2013-07-08 35 views
0
<!-- language: c# --> 

我想从路径效应PART_ShadowOpacity后面的代码改变。 我试过GetTemplateChild方法,但它仅返回NULL 艾策斯Path.Effect Propertys从代码隐藏

<Path x:Name="PART_Path" Stretch="Fill" StrokeThickness="1.0" Stroke="#ff1c1c1a"> 
    <Path.Effect> 
     <DropShadowEffect x:Name="PART_Shadow" Color="LightGray" BlurRadius="5" Direction="45"  
      ShadowDepth="3" RenderingBias="Performance"/> 
    </Path.Effect> 
</Path> 

回答

0

找到它了。我试图找到它太早,在OnApplyTemplateGetTemplateChild工作。

public override void OnApplyTemplate() 
{ 
    base.OnApplyTemplate(); 
    var _Shadow = GetTemplateChild("PART_Shadow"); 
}