JElster
asked on
WPF - Template.FindName - Can't Find
I have the following template
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type FlowDocumentReader}">
<Button x:Name="btnPrint" Height="25" Width="70" ToolTip="Print" Margin="5,0,0,0" >
But when I run my code to find the buttonl... it's always returns null ..
Button btnPrint = (Button)this.flowdocReader .Template. FindName(" btnPrint", this.flowd ocReader);
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type FlowDocumentReader}">
<Button x:Name="btnPrint" Height="25" Width="70" ToolTip="Print" Margin="5,0,0,0" >
But when I run my code to find the buttonl... it's always returns null ..
Button btnPrint = (Button)this.flowdocReader
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had my code in OnApplyTemplate()
Which previous articles mentioned... but it does Not Find it.
It DOES in the Window_Loaded()
thanks..
I've been trying to every option to wire up a style/template button to a page.
I'm new to all this...
Which previous articles mentioned... but it does Not Find it.
It DOES in the Window_Loaded()
thanks..
I've been trying to every option to wire up a style/template button to a page.
I'm new to all this...
Where must be a better what to do what you are doing (which I don't know what exactly).