none
Bug in layout of ItemTemplate when ItemsControl inside ScrollViewer (items are not stretched) RRS feed

  • Question

  • Using the following Xaml produces a vertically scrollable list with texts inside a black border with white background:

    <ScrollViewer Background="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Height="100" Width="250">
       <ItemsControl>
        <ItemsControl.Items>
         <SolidColorBrush Color="Black" />
         <SolidColorBrush Color="Black" />
         <SolidColorBrush Color="Black" />
         <SolidColorBrush Color="Black" />
         <SolidColorBrush Color="Black" />
         <SolidColorBrush Color="Black" />
         <SolidColorBrush Color="Black" />
        </ItemsControl.Items>
        <ItemsControl.ItemTemplate>
         <DataTemplate>
          <Border BorderBrush="Black" BorderThickness="1" Background="White">
           <TextBlock Text="Should extend to entire width" />
          </Border>
         </DataTemplate>
        </ItemsControl.ItemTemplate>
       </ItemsControl>
      </ScrollViewer>

    In Blend (and Silverlight and WPF) the generated content (from the DataTemplate) stretches the entire width of the ScrollViewer. But in Windows EC 7 it only occupies the space necessary for the text.

    Does anyone know of a fix, or workaround? (Or how to report this to the Embedded Compact team?)

    (Updated 27/11 2013 to remove dependency on Property)
    • Edited by MarNilss Wednesday, November 27, 2013 2:25 PM Updated sample
    Tuesday, November 26, 2013 3:02 PM

All replies

  • Thought I'd write an update to this.

    We've reported this to Microsoft and both the escalation officer and the WEC7 team found it to be a bug.

    BUT, since we aren't a big enough customer (too few devices sold per year) our request for a QFE won't be accepted, i.e. they won't fix it for us.

    So if there is someone else out there with a bigger project (in terms of devices/year) you're welcome to use my sample above and file your own bug report, because otherwise it won't get fixed.

    Friday, January 17, 2014 2:40 PM