<ListBox ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding
Collection}">

       <ListBox.ItemContainerStyle>

              <Style TargetType="ListBoxItem">

                     <Setter Property="HorizontalContentAlignment"
Value="Stretch"/>

              </Style>

       </ListBox.ItemContainerStyle>

</ListBox>

 

THIS WORKS!

 

I was afraid that the Border around the Grid would ruin the stretching, but
it works anyway. Thanks for that. I'm happy to remove the event code I
posted yesterday and use the Setter instead. I'm always happy to remove
code.

 

Because you asked, below is my ListBox definition.

 

Greg

 

 

<ListBox x:Name="listJobs" BorderThickness="0"

         IsEnabled="{Binding HomeBinder.IsNotBusy, Source={StaticResource
binders}}"

         Visibility="{Binding HomeBinder.ListVisible, Source={StaticResource
binders}}"

         ItemsSource="{Binding HomeBinder.JobItems, Source={StaticResource
binders}}">

  <ListBox.ItemContainerStyle>

    <Style TargetType="ListBoxItem">

      <Setter Property="HorizontalContentAlignment" Value="Stretch"/>

    </Style>

  </ListBox.ItemContainerStyle>

  <ListBox.ItemTemplate>

    <DataTemplate>

      <Border x:Name="bordItem" CornerRadius="0" BorderThickness="1"
BorderBrush="#FF666666">

        <Grid x:Name="gridItem">

          <Grid.RowDefinitions>

            <RowDefinition Height="1*"/>

          </Grid.RowDefinitions>

          <Grid.ColumnDefinitions>

            <ColumnDefinition Width="65" />

            <ColumnDefinition Width="*" />

          </Grid.ColumnDefinitions>

          <Grid.Background>

            <LinearGradientBrush EndPoint="0,0" StartPoint="1,1">

              <GradientStop Color="#FFE0E0E0"/>

              <GradientStop Color="#FFFFFFFF" Offset="0.5"/>

            </LinearGradientBrush>

          </Grid.Background>

          <Image x:Name="imgItem" Width="50" Stretch="Uniform"
Grid.Column="0" Source="{Binding Converter={StaticResource ItemConverter},
ConverterParameter=1}" HorizontalAlignment="Center"
VerticalAlignment="Center"/>

          <StackPanel x:Name="stackItem" Orientation="Vertical"
Grid.Column="1">

            <HyperlinkButton x:Name="linkItemResComment" Margin="0,0,10,0"

                       Content="{Binding Converter={StaticResource
ItemConverter}, ConverterParameter=5}"

                       Style="{StaticResource ItemSelStyle}"

                       Click="linkItemResComment_Click"

                       IsEnabled="{Binding Converter={StaticResource
ItemConverter}, ConverterParameter=6}"

                       Tag="{Binding Converter={StaticResource
ItemConverter}, ConverterParameter=10}"

                       HorizontalContentAlignment="Left" />

            <TextBlock x:Name="textItemResName" TextWrapping="Wrap"
Margin="0,0,10,0"

                       Text="{Binding Converter={StaticResource
ItemConverter}, ConverterParameter=3}"

                       Style="{StaticResource ItemNameStyle}"/>

            <TextBlock x:Name="textItemResCreated" TextWrapping="Wrap"

                       Text="{Binding Converter={StaticResource
ItemConverter}, ConverterParameter=2}"

                       Style="{StaticResource ItemCreatedStyle}"

                       Foreground="{Binding Converter={StaticResource
ItemConverter}, ConverterParameter=4}" Margin="0,0,10,2"/>

          </StackPanel>

        </Grid>

      </Border>

    </DataTemplate>

  </ListBox.ItemTemplate>

</ListBox>

 

_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to