Reputation: 3875
I am trying to create a property panel, and I am using a listbox. I don't know another way of making a dynamic table, so this is what I did:
<DataTemplate x:Key="PropertyListTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" />
<ComboBox x:Name="combo"
Grid.Column="1"
ItemsSource="{Binding ComboItems}"
SelectedIndex="{Binding Value, Mode=TwoWay}"
Visibility="Hidden" />
<TextBox x:Name="text"
Grid.Column="1"
Text="{Binding Value, Mode=TwoWay}"
Visibility="Hidden" />
<!-- ... More controls -->
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding TypeString}" Value="Combobox">
<Setter TargetName="combo" Property="Visibility" Value="Visible" />
</DataTrigger>
<!-- ... More triggers -->
</DataTemplate.Triggers>
</DataTemplate>
The problem is this:
When the textbox or the combobox overflows, it resizes automatically. How can I disable this behavior? The width of the control should be adjusted depending on the width of the parent listbox... I don't want any horizontal scrollbars...
Upvotes: 0
Views: 572
Reputation: 45096
Then turn horizontal scroll bars off (disable) on the parent ListBox.
Upvotes: 5