I have a grid that looks like follow:
<Grid Grid.Column="0" Grid.Row="0" Margin="20,50,10,10"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="0.5*" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> </Grid>
And inside the grid, I place a combobox:
<ComboBox Grid.Row="3" Grid.Column="1" FontWeight="Bold" FontSize="28" VerticalAlignment="Center" VerticalContentAlignment="Center" Padding="10,0,0,0" SelectedItem="{Binding Language, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Languages, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,0,0"> <ComboBox.ItemContainerStyle> <Style TargetType="{x:Type ComboBoxItem}"> <Setter Property="FontSize" Value="28" /> </Style> </ComboBox.ItemContainerStyle> </ComboBox>
My problem is, that the combobox does not automatically fit the whole height of grid as you can see here:
In contrast, the TextBox always fit the whole size of grid. How can I customize, that ComboBox auto fit to grid size?
I am using the thememanager with following code:
public partial class MainWindow : XamRibbonWindow { public MainWindow() { InitializeComponent(); ThemeManager.ApplicationTheme = new Office2013Theme(); } }
When I comment out the thememanager, then it works as I wish.
Hello Jean-Pascal Robert-Nicoud,
Thank you for your post.
I have been looking into this issue you are seeing, and I have reproduced it. It appears that there may be an issue in the Styles.WPF.xaml file that exists for the Office2013 theme, in which the default Office2013 style for ComboBox appears to hard-code the Height of that control. This is likely meant to be a setting of the MinHeight property and a mistake was made. This is fortunately simple to work around though. Simply set the Height property of your ComboBox to "Auto" and you should see it take up the space allotted to it by the grid.
I have brought this issue to the attention of our development teams. I have logged this issue in our internal tracking system with a development ID of 212956. The next step will be for a developer to review my findings and resolve this issue with the Office2013 theme.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Please I need it as soon as possible.
Thanks