Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts 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

ComboBox Padding in Feb CTP Breaks Jan CTP Behavior

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-29-2006   #1 (permalink)
Erik Thomas
Guest


 

ComboBox Padding in Feb CTP Breaks Jan CTP Behavior

In the Jan CTP, we were able to make comboboxes short (like 16, but with
default font) and if the style included VerticalAlignment="Center" we could
see the selected text centered vertically. With Feb CTP the text is cut off
at the bottom. It's like the top is padded even though we've set the top and
bottom padding to zero.

Does anyone know of a workaround for this?

To see this problem first hand, paste the XAML below into the Feb CTP
version of XAMLPad.

Do I need to create a control template to work around this new bug? If so,
can someone provide a sample of how to create a control template just for the
selected text part of a combobox? ItemTemplate does not affect the selected
text box portion of a ComboBox.

Thanks!

Erik

For XAMLPad:

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Page.Resources>
<Style TargetType="{x:Type ComboBox}" x:Key="DropDownStyle">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="1,0,1,0" />
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="16" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="100" />
</Style>
</Page.Resources>
<Grid>
<ComboBox Style="{StaticResource DropDownStyle}" SelectedIndex="1">
<ComboBoxItem>Entry One</ComboBoxItem>
<ComboBoxItem>Entry Two</ComboBoxItem>
<ComboBoxItem>Entry Three</ComboBoxItem>
</ComboBox>
</Grid>
</Page>

My System SpecsSystem Spec
Old 03-29-2006   #2 (permalink)
Erik Thomas
Guest


 

RE: ComboBox Padding in Feb CTP Breaks Jan CTP Behavior

I just found a workaround minutes after posting this. The workaround is
bizarre but seems to work. I just have to set the Padding to a negative
number.

<Setter Property="Padding" Value="1,-2,1,0" />

The -2 actually works! I'm still interested in finding out if this is listed
as a bug to be fixed in Beta 2?

Thanks.

Erik

"Erik Thomas" wrote:

> In the Jan CTP, we were able to make comboboxes short (like 16, but with
> default font) and if the style included VerticalAlignment="Center" we could
> see the selected text centered vertically. With Feb CTP the text is cut off
> at the bottom. It's like the top is padded even though we've set the top and
> bottom padding to zero.
>
> Does anyone know of a workaround for this?
>
> To see this problem first hand, paste the XAML below into the Feb CTP
> version of XAMLPad.
>
> Do I need to create a control template to work around this new bug? If so,
> can someone provide a sample of how to create a control template just for the
> selected text part of a combobox? ItemTemplate does not affect the selected
> text box portion of a ComboBox.
>
> Thanks!
>
> Erik
>
> For XAMLPad:
>
> <Page
> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
> <Page.Resources>
> <Style TargetType="{x:Type ComboBox}" x:Key="DropDownStyle">
> <Setter Property="BorderThickness" Value="0" />
> <Setter Property="Padding" Value="1,0,1,0" />
> <Setter Property="Margin" Value="0" />
> <Setter Property="Height" Value="16" />
> <Setter Property="VerticalAlignment" Value="Center" />
> <Setter Property="Width" Value="100" />
> </Style>
> </Page.Resources>
> <Grid>
> <ComboBox Style="{StaticResource DropDownStyle}" SelectedIndex="1">
> <ComboBoxItem>Entry One</ComboBoxItem>
> <ComboBoxItem>Entry Two</ComboBoxItem>
> <ComboBoxItem>Entry Three</ComboBoxItem>
> </ComboBox>
> </Grid>
> </Page>

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
reduce padding in StackPanel John Taylor Avalon 1 08-26-2007 04:21 PM
ComboBox Problem Bahadýr ARSLAN Avalon 6 08-26-2007 04:17 PM
Smart-quote behavior: Is current behavior ideal? Alex K. Angelopoulos [MVP] PowerShell 0 08-16-2006 01:39 PM
combobox-transperent 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