Link to home
Create AccountLog in
Avatar of Dennis_T_Holm
Dennis_T_Holm

asked on

ListBox ItemTemplate. TextBox and ComboBox dont react to width

I want to display Some labels, textbox and combobox in a ListBox. Therefore i have created an ItemTemplate which describes how each item is to be presented. Problem is that im not able to set the width of my textbox and combobox. they just dont react when setting the width property... I have tried putting my labels, combobox and textbox into a grid, stackpanel, etc. But im just not able to make this work....


<ListBox ItemsSource="{Binding Routes}">
   <ListBox.ItemTemplate>
       <StackPanel Orientation="Horizontal" VerticalAlignment="left">
         <TextBox VerticalAlignment="left" Width="60" Text="{Binding Width}" />
         <TextBox VerticalAlignment="left" Width="100" Text="{Binding Name}"/>
         <ComboBox VerticalAlignment="left" Width="40" ItemsSource="{Binding Color}"/>
       </StackPanel>
   </ListBox.ItemTemplate>
 </ListBox>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dennis_T_Holm
Dennis_T_Holm

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer