locked
Image auto size RRS feed

  • Question

  • User128877 posted

    Hi I need do Image width max and image height auto size. I try

    <Frame Padding="5">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Image Source="{Binding Title}" Aspect="AspectFill"/>
        </Grid>
    </Frame>
    

    The frame is in the ListView item. But it is not work. How i can do it?

    Friday, September 4, 2015 8:47 AM

All replies

  • User76916 posted

    @Vunda AspectFill is correct if you are using it to fill the whole image size available but it will make the image size to the size of the container.

    Does this work? (Remove the Frame and change Height to a star). This is normally how I would do it and it works well.

    <Grid Padding="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Image Source="{Binding Title}" Aspect="AspectFill"/>
        </Grid>
    
    Friday, September 4, 2015 9:26 AM
  • User128877 posted

    Without frame doesn't work. Item height (ListItem) doesn't changing auto.

    Friday, September 4, 2015 9:29 AM
  • User197000 posted

    @AntonDashivskyi said: Without frame doesn't work. Item height (ListItem) doesn't changing auto.

    Did you get it ?

    Saturday, July 14, 2018 9:25 PM