Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

WPF combobox background

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 06-08-2007   #1 (permalink)
Michael Jackson
Guest


 

WPF combobox background

The entire UI of my new application mimics the UI of Microsoft Expression
Blend.
I'm trying to get the background of the combobox to be the very dark grey,
but can't make it happen.

How can I change the background of a combobox, either IsEditable = true or
false.

Thanks



My System SpecsSystem Spec
Old 06-11-2007   #2 (permalink)
David Cater
Guest


 

Re: WPF combobox background

It appears that the background of the collapsed part of the combo box is
easily set using the Background attribute. I assume you're referring to the
popup part of the combo box. I haven't experimented with it yet, but I know
that the ComboBox control uses the PART_* architecture for identifying the
popup element that gets brought up when you expand the ComboBox. It looks
for a part called "PART_Popup". That is a <Popup> element.

So what does that mean for you? If you were to create your own control
template for the ComboBox, you would want to make sure you have a <Popup>
element in your template called PART_Popup. That would have a background
color set to be the same as the background color for the combo box itself.
I'm not sure how you would define PART_Popup itself, although it's possible
you could just define the Popup with nothing inside it and the control would
do the work of binding it to the items in the combo box.

Like I said, I haven't tried any of that. But it might get you started in
the right direction.

David Cater

"Michael Jackson" <michaeldjackson@suddenlink.net> wrote in message
news:466a2676$0$4303$bbae4d71@news.suddenlink.net...
> The entire UI of my new application mimics the UI of Microsoft Expression
> Blend.
> I'm trying to get the background of the combobox to be the very dark grey,
> but can't make it happen.
>
> How can I change the background of a combobox, either IsEditable = true or
> false.
>
> Thanks
>


My System SpecsSystem Spec
Old 06-11-2007   #3 (permalink)
David Cater
Guest


 

Re: WPF combobox background

Scratch that. I was doing some experiments myself, and it's actually much
easier than that. You don't have to completely override the control
template, which is the direction my first response was going. All you have
to change is the ItemsPanel, which controls how the items in the ComboBox
are displayed on popup:

<ComboBox Background="DarkGray" Foreground="White">
<ComboBox.ItemsSource>
<coll:ArrayList>
<sys:String>A</sys:String>
<sys:String>B</sys:String>
<sys:String>C</sys:String>
</coll:ArrayList>
</ComboBox.ItemsSource>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Background="DarkGray"/>
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>

David Cater


"David Cater" <xiard@mindspring.com> wrote in message
news:uAi%23lBDrHHA.4100@TK2MSFTNGP06.phx.gbl...
> It appears that the background of the collapsed part of the combo box is
> easily set using the Background attribute. I assume you're referring to
> the popup part of the combo box. I haven't experimented with it yet, but
> I know that the ComboBox control uses the PART_* architecture for
> identifying the popup element that gets brought up when you expand the
> ComboBox. It looks for a part called "PART_Popup". That is a <Popup>
> element.
>
> So what does that mean for you? If you were to create your own control
> template for the ComboBox, you would want to make sure you have a <Popup>
> element in your template called PART_Popup. That would have a background
> color set to be the same as the background color for the combo box itself.
> I'm not sure how you would define PART_Popup itself, although it's
> possible you could just define the Popup with nothing inside it and the
> control would do the work of binding it to the items in the combo box.
>
> Like I said, I haven't tried any of that. But it might get you started in
> the right direction.
>
> David Cater
>
> "Michael Jackson" <michaeldjackson@suddenlink.net> wrote in message
> news:466a2676$0$4303$bbae4d71@news.suddenlink.net...
>> The entire UI of my new application mimics the UI of Microsoft Expression
>> Blend.
>> I'm trying to get the background of the combobox to be the very dark
>> grey, but can't make it happen.
>>
>> How can I change the background of a combobox, either IsEditable = true
>> or false.
>>
>> Thanks
>>

>


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Combobox in WPF askaile Avalon 2 09-24-2007 02:47 AM
ComboBox Problem Bahadýr ARSLAN Avalon 6 08-26-2007 04:17 PM
ComboBox Problem Bahadýr ARSLAN Avalon 0 08-20-2007 01:47 AM
ComboBox on black background John Lorenzen Avalon 2 11-02-2006 04:05 PM
combobox- transperant crish Avalon 0 03-08-2006 06:11 AM


Vistax64.com 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 2005-2008

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 47 48 49 50 51