I have list box ,user can group any number of items .I want to show a red rectangle around grouped items.I tried using adorners but it seems adorner can be drawn on single control.Is there any simpler way to achieve it ,may be in xaml only.
<ListBox ItemsSource="{Binding MyList, RelativeSource={RelativeSource AncestorType={x:Type Window}}}">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Height="50" Width="100" Background="Yellow">
<TextBlock Text="{Binding item}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
As XAMIMAX suggested. You need to write style for the GroupItem. Refer below code.