I got curious about this, so did a quick proof of concept of one way to get it done.

I used an ItemsControl
bound to a collection of items.
The ItemsPanelTemplate
is a WrapPanel
, and the ItemTemplate
is a custom template. There is also a DataTrigger
to change the Template of the last item to be a borderless TextBox
for text entry.
<Grid>
<TextBox IsHitTestVisible="False" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" /> <!-- For Border -->
<ItemsControl ItemsSource="{Binding Values}" Margin="4">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Content="{Binding}">
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Border BorderBrush="Gray" BorderThickness="1" CornerRadius="4" Padding="4">
<TextBlock Text="{Binding SomeString}" />
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Value}" Value="0">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBox Text="{Binding SomeString}" BorderThickness="0" Padding="5" Width="50" />
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
It should be pretty easy to take something like this and add extra functionality :
ItemTemplate
can be updated to look like what you have. I am guessing an IValueConverter
is used to convert the Text value into a Color
for the bar along the bottom
X button on the ItemTemplate
can be bound to an ICommand
to remove an item from the list, and can bind the current object as the CommandParameter
to know which item to remove.
A PropertyChange notification can be used when TextBox is changed to signal that it should flip a switch to make the last item in the list a "saved" item, and add another "new" item for the TextBox binding.
Overall, shouldn't be too hard to achieve what you're looking for.
And this is one of the reasons why I love working with WPF! Can make almost any control I want with ease. :D