![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Smart-quote behavior: Is current behavior ideal? | PowerShell | |||