Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF:Combobox content stretch

$
0
0

 Hi Guys,

 I'm trying make the combo-box content stretchable but it's not working. could you please tell me, how can I fix this? Thank you very much.

Combo-Box:

<ComboBox Margin="348,45,0,0" Name="listBox3" HorizontalAlignment="Left" FontSize="20" Style="{StaticResource ComboBoxStyle}"
VerticalAlignment="Top" Width="220"  HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
FontFamily="{DynamicResource FontFamilyRes}"  SelectionChanged="listBox3_SelectionChanged" Height="31"></ComboBox>


Combo-Box Style:

<Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}"><Setter Property="Foreground" Value="Black"/><Setter Property="BorderThickness" Value="3"/><Setter Property="Padding" Value="6"/><Setter Property="Margin" Value="5"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type ComboBox}"><Grid><!--Binding explanation follows--><!--The SystemParameters.ComboBoxPopupAnimationKey is the standard roll-down animation for dropdowns--><Popup Margin="1" x:Name="PART_Popup" AllowsTransparency="true"
        						IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
        						Placement="Bottom"
        						PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
        						Grid.ColumnSpan="2"><Border x:Name="DropDownBorder" Width="124" BorderThickness="1,0,1,1" CornerRadius="0,0,4,4" BorderBrush="#FFC4DEFF"><Border.Background><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="#FFDEEDFF" Offset="0" /><GradientStop Color="#C1FFFFFF" Offset="1" /></LinearGradientBrush></Border.Background><ScrollViewer CanContentScroll="True"><ItemsPresenter  /></ScrollViewer></Border></Popup><ToggleButton Style="{StaticResource cmbToggle}" Grid.ColumnSpan="2" HorizontalContentAlignment="Stretch"
        						IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/><ContentPresenter HorizontalAlignment="Left" 
        						Margin="5,0,0,0"
        						VerticalAlignment="Center" 
        						IsHitTestVisible="false"
        						Content="{TemplateBinding SelectionBoxItem}"
                                        /></Grid></ControlTemplate></Setter.Value></Setter></Style>

Image:



  

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>