when i select an item it's background is the width of my form but why is my border and background only as wide as what's required for it's content???
Code:
<ListBox HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="White" ItemsSource="{Binding}" ItemTemplate="{StaticResource Member}" IsSynchronizedWithCurrentItem="true" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.CanContentScroll="True" BorderThickness="0" Background="Transparent" x:Name="MembersList" Grid.Column="1" Grid.Row="1" SelectionMode="Single">
</ListBox>
Code:
<DataTemplate x:Key="Member" x:Name="MemberItem">
<Border HorizontalAlignment="Stretch" Background="White" BorderBrush="Black" BorderThickness="2" CornerRadius="15" Padding="10px" Margin="5px" >
<Grid Background="Aqua">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="3px"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30px"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Grid.Row="0" Margin="2" Foreground="Black" x:Name="Member_Name" Text="{Binding Path=MName}"></TextBlock>
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" Margin="2">
<TextBlock Foreground="Black" x:Name="Member_ID_Name" Text="Member ID: "></TextBlock>
<TextBlock Foreground="Black" x:Name="Member_ID" Text="{Binding Path=MID}"></TextBlock>
</StackPanel>
<Image Grid.RowSpan="2" Grid.Column="0" Grid.Row="0" Height="30px" Width="30px" Source="member.gif"></Image>
</Grid>
</Border>
</DataTemplate>