KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having problems making a ComboBox stretch to fill the whole column width in a GridViewColumn . It should also resize when the column is resized. In the following example I have a StackPanel with a ComboBox inside. This is set to stretch and will in fact stretch to fill the StackPanel width. Then I add a ListView with one column, containing a StackPanel with a ComboBox . Both the StackPanel and the ComboBox are set to stretch, but they don't. I use background colors to identify the size of the StackPanel s, and there is no red unless I set a width or add elements to the ComboBox such that it needs more width. I also tried playing around with the HorizontalContentAlignment property without success. <StackPanel Height="59" Margin="45,12,38,0" VerticalAlignment="Top" Background="Green"> <ComboBox HorizontalAlignment="Stretch" /> </StackPanel> <ListView x:Name="MyListView" Margin="0,106,0,0"> <ListView.View> <GridView> <GridViewColumn Header="Num" Width="70"> <GridViewColumn.CellTemplate> <DataTemplate> <StackPanel Background="red" Orientation="Horizontal" HorizontalAlignment="Stretch"> <ComboBox HorizontalAlignment="Stretch" /> </StackPanel> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> <ListViewItem></ListViewItem> </ListView>
Tags (comma-separated)
Save Edits
Cancel