Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Problem with ImageButton when changing the Source-Image

$
0
0

Hi,

I'm using the new ImageButton to implement a ToggleButton which switches between a "Locked" and "Unlocked" state.
The "Source"-Property is bound to a bool-Property in the ViewModel and using a ValueConverter to set the name of the according image:

            <ImageButton                    
                Command="{Binding ToggleLockStateCommand}"
                BackgroundColor="Transparent"
                Source="{Binding Locked, Converter={StaticResource cnvLockStateToImage}}">

Changing the images works as expected but after changing the image is not correctly sized, it randomly switches between "very small" and the original size.

I already verified that the ImageButton doesn't change its size when the Source is changed (which is expected as the two images are of the same size).

Anybody has an idea how to fix this (or maybe it's a bug?) My target-platform is Android.

-Michael


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>