Click here to Skip to main content
15,909,827 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
Member 454056418-Feb-10 10:10
Member 454056418-Feb-10 10:10 
QuestionSharing Core Objects Between Server & Client Pin
Jammer12-Feb-10 7:57
Jammer12-Feb-10 7:57 
AnswerRe: Sharing Core Objects Between Server & Client Pin
Pete O'Hanlon12-Feb-10 9:33
mvePete O'Hanlon12-Feb-10 9:33 
GeneralRe: Sharing Core Objects Between Server & Client Pin
Jammer13-Feb-10 12:51
Jammer13-Feb-10 12:51 
QuestionPopup window in silverlight Pin
xodeblack12-Feb-10 6:01
xodeblack12-Feb-10 6:01 
AnswerRe: Popup window in silverlight Pin
Abhinav S12-Feb-10 8:10
Abhinav S12-Feb-10 8:10 
Questioncontrols visible in designer but not available in window at runtime [modified] Pin
Member 290565112-Feb-10 2:30
Member 290565112-Feb-10 2:30 
QuestionButton click event within a ControlTemplate? Pin
Richard Dutton12-Feb-10 1:02
Richard Dutton12-Feb-10 1:02 
Hi,

I have a class which derives from TextBox called EntryTextBox and provides a PreviewKeyDown event handler (although for the purposes of this question, it's not relevant).

I have produced a ControlTemplate within a style as follows:

<Style TargetType="{x:Type my:EntryTextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type my:EntryTextBox}">
<DockPanel>
<Border BorderThickness="1" HorizontalAlignment="Stretch" BorderBrush="DarkGray" Background="White" Width="100">
<DockPanel>
<Button DockPanel.Dock="Right" Visibility="{Binding Path=KeyboardPopup,Converter={StaticResource VisibilityConverter},RelativeSource={RelativeSource TemplatedParent}}">
<ContentControl Width="15" Height="10" Template="{StaticResource KeyboardIconContent}"/>
</Button>
<ScrollViewer Margin="0" Background="Transparent" HorizontalAlignment="Stretch" x:Name="PART_ContentHost"/>
</DockPanel>
</Border>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

Which as you can see displays a Button as part of the TextEntry box depending on the value of KeyboardPopup. This works fine, but I want to be able to act on the button's click handler from within my EntryTextBox class but don't know how to do it.

I've read in "Pro WPF in C# 2008, Matthew MacDonald, P872" that you need to "give your elements recognisable names and attach event handlers to them programatically in the control constructor" but I am unsure of the syntax I should use in the class constructor of EntryTextBox.

Can anyone help me?

Cheers

Richard
AnswerRe: Button click event within a ControlTemplate? Pin
rhuiden12-Feb-10 4:59
rhuiden12-Feb-10 4:59 
GeneralRe: Button click event within a ControlTemplate? Pin
Richard Dutton12-Feb-10 5:05
Richard Dutton12-Feb-10 5:05 
QuestionMessage Removed Pin
11-Feb-10 7:39
fjparisIII11-Feb-10 7:39 
AnswerRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 8:24
mentorNot Active11-Feb-10 8:24 
GeneralMessage Removed Pin
11-Feb-10 8:43
fjparisIII11-Feb-10 8:43 
GeneralRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 9:18
mentorNot Active11-Feb-10 9:18 
GeneralMessage Removed Pin
11-Feb-10 9:46
fjparisIII11-Feb-10 9:46 
GeneralRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 10:53
mentorNot Active11-Feb-10 10:53 
GeneralMessage Removed Pin
11-Feb-10 11:21
fjparisIII11-Feb-10 11:21 
GeneralRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 11:42
mentorNot Active11-Feb-10 11:42 
QuestionSilverlight application does not run Pin
jonatan_55611-Feb-10 1:58
jonatan_55611-Feb-10 1:58 
AnswerRe: Silverlight application does not run Pin
Abhinav S11-Feb-10 6:07
Abhinav S11-Feb-10 6:07 
GeneralRe: Silverlight application does not run Pin
jonatan_55612-Feb-10 3:18
jonatan_55612-Feb-10 3:18 
GeneralRe: Silverlight application does not run Pin
Abhinav S12-Feb-10 8:04
Abhinav S12-Feb-10 8:04 
QuestionPartial-trust on-screen keyboard? Pin
Richard Dutton11-Feb-10 0:01
Richard Dutton11-Feb-10 0:01 
QuestionAnimation problem Pin
fjparisIII10-Feb-10 20:08
fjparisIII10-Feb-10 20:08 
AnswerRe: Animation problem Pin
Abhinav S10-Feb-10 22:18
Abhinav S10-Feb-10 22:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.