<ItemsControl ItemsSource="{Binding MyList}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Name="horizontalLabels" Orientation="Horizontal" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}" Width="{Binding DataContext.LabelWidth, RelativeSource={RelativeSource AncestorType=ItemsControl},UpdateSourceTrigger=PropertyChanged}" Background="Red" Height="30" FontSize="12" > </TextBlock> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>
public void AddLabels(double parameters) { MyList.Add("dummy"); MyWidth.Add(30); MyList.Add("dummy2"); MyWidth.Add(60);}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)