PDA

Click to See Complete Forum and Search --> : [RESOLVED] Rounded Combobox


dee-u
Oct 14th, 2009, 02:24 AM
Why does the dropdown arrow disappears when I try to use the following code? Is there any other method which I can round out the corners of the combobox? Thanks!

<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
<Grid>
<Border x:Name="border" Background="White" BorderBrush="#FFFFC934" BorderThickness="2" CornerRadius="10,10,10,10" Width="Auto" Height="Auto">
</Border>
</Grid>
</ControlTemplate>

chris128
Oct 14th, 2009, 08:12 AM
I'm no expert on control templates but I think when you define a control template you are defining the entire control. So the combobox that you apply that template to will be JUST that border that you have defined and nothing else - hence the drop down arrow disappearing.
From what I remember, you can assign special names to "parts" of your control template and then WPF will treat them in the same way as their standard control counterpart. For example the little dropdown arrow might be named PART_DropDown in the standard combobox control template, so if you define something in your template and name it that same name then WPF will make it do the same things as the normal one would do (but without the same visual effects obviously as thats for you to define). I'm not sure whether the little arrow in a combobox is actually a separate part though, but you can find out by using Expression Blend to edit a copy of the combobox control template and examining the 'internals' of it.

Sorry if any of the above is not 100% correct but its been a while since I did anything like that. Have a look on the web for Control Template tutorials :)

dee-u
Oct 15th, 2009, 02:11 AM
Upon searching and trial and error I was able to get the look that I want. It occured to me that a ComboBox is composed of various controls and I needed to modify the borders of those controls to suit my needs. Attached is a sample project that has the modified control template if anyone is interested.

chris128
Oct 15th, 2009, 04:39 AM
Nice :)

RobDog888
Oct 15th, 2009, 11:54 PM
Subscribed

decuser
Apr 17th, 2011, 01:21 AM
Hi dee-u,
Attached project that helps a lot for the rounded combobox
Do you have all other controls template
if yes please attach only the control templates..i just wanted to explore all this

Thanks
decuser.

dee-u
Apr 18th, 2011, 01:33 AM
Hi dee-u,
Attached project that helps a lot for the rounded combobox
Do you have all other controls template
if yes please attach only the control templates..i just wanted to explore all this

Thanks
decuser.

You can try searching them in MSDN. :)

decuser
Apr 18th, 2011, 01:55 AM
Hi,

I am interested in control templates of the control available in the NetVerse screen.I searched MSDN couldn;t get the ones i wanted.
I saw your netverse screen and with you sample project i could see only combobox template not the other ones..i just need the button,textbox templates as available in the screen

kindly help me

thanks
decuser

RobDog888
Apr 19th, 2011, 12:24 PM
All the rounded control templates are in the netverser project. This one is just for hte rounded combobox

RobDog888
Apr 19th, 2011, 12:34 PM
Here is the link to the project in CodeBank
http://www.vbforums.com/showthread.php?p=3631718#post3631718

Check out the NetVerserStyles.xaml file ;)