Silverlight: stretch ListBoxItem horizontally.

Very often you need to stretch your ListBoxItem horizontally. If the ListBox is simple (without ItemTemplate), there is easy solution: just add


to the ListBox.

However, in second way the solution is easy too. But frequently we spend a lot of time to fix it. There is a solution:

<Style TargetType=”ListBoxItem”>
<Setter Property=”HorizontalContentAlignment” Value=”Stretch”></Setter>



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s