S
S
SUDALV2014-12-24 12:12:20
C++ / C#
SUDALV, 2014-12-24 12:12:20

WinRT XAML, why doesn't the stretch property work in one case, but in another?

There is a ListView whose element template is the Grid written below.
The first Image, which is attached to User.PictureUrl, is cropped to the desired square, and the Image that is inside the nested GridView is only scaled, but if the picture is not square, then empty space remains on the sides. Why is this happening? It is necessary that in the second case it is also cut off to a square.

<Grid Background="#70000000" Width="{Binding Width, ElementName=FeedListView}" >
                                   <!--описание строк и колонок я опустил-->
     <Image Grid.Column="0" Width="70" Height="70" Grid.Row="0" Grid.RowSpan="4" Source="{Binding User.PictureUrl}" VerticalAlignment="Top" Stretch="UniformToFill"/>
     <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Message}" Margin="10,0,10,0" FontSize="16" TextWrapping="Wrap"/>
     <GridView Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" ItemsSource="{Binding Attachments}" Tapped="ImageClick" SelectionMode="None" Visibility="{Binding AttachmentsVisibility}">
          <GridView.ItemsPanel>
               <ItemsPanelTemplate>
                    <WrapGrid Orientation="Horizontal"/>
              </ItemsPanelTemplate>
         </GridView.ItemsPanel>
         <GridView.ItemTemplate>
             <DataTemplate>
                  <Grid Width="90" Height="90">
                          <Image Stretch="UniformToFill" Source="{Binding Image}"/>
                 </Grid>
            </DataTemplate>
       </GridView.ItemTemplate>
</GridView>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question