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 - ComboBox Padding in Feb CTP Breaks Jan CTP Behavior

 
 
Old 03-29-2006   #1 (permalink)
Erik Thomas


 
 

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


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
Smart-quote behavior: Is current behavior ideal? PowerShell


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