Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Why is this so difficult (Template question)

 
 
Old 01-19-2008   #1 (permalink)
russell.smallwood


 
 

Why is this so difficult (Template question)

Hello all,

I'm trying to do something that I thought would be simple with wpf.
Basically, I want to create a template that sticks a TextBlock on the
end of a ComboBox.

The idea is that when my forms are in "edit" mode that the required
fields are marked with a red asterisk. While I've figured out how to
do this with a textbox:

<Style x:Key="RequiredEditableTextBox" TargetType="{x:Type
TextBox}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate
x:Key="RequiredEditableTextBoxTemplate" TargetType="{x:Type TextBox}">
<StackPanel Orientation="Horizontal">
<TextBox Text="{TemplateBinding Text}"/>
<TextBlock Style="{StaticResource
RequiredFieldGlyph}"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I'm mystified as to how one would accomplish this with a more complex
control like a combobox.

What I really want is a template that refers to the parent control,
essentially saying "Draw yourself here"

<Style x:Key="RequiredEditableComboBox" TargetType="{x:Type
ComboBox}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate
x:Key="RequiredEditableComboBoxTemplate" TargetType="{x:Type
ComboBox}">
<StackPanel Orientation="Horizontal">
---I WANT TO DRAW THE ORIGNIAL COMBOBOX HERE
--
<TextBlock Style="{StaticResource
RequiredFieldGlyph}"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

But I can figure out how. The difficulty I'm having leads me to
believe that I may be thinking of the problem in the wrong context
etc.

Any ideas would be appreciated.

Thanks

-r

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Easy v/s Difficult Chillout Room
Vista is very difficult to use Vista General
Difficult question Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46