I am developing a windows store application and need help in binding a flipView with an ObservableCollection<WriteableBitmap>
Below is the way i am doing it right now ,
XAML :
<FlipView x:Name="flipView" Grid.Row="1" Margin="0,0,20,0" ItemsSource="{Binding BitMapCollection}" Visibility="{Binding FlipViewVisibility}" >
</FlipView>
ViewModel :
ObservableCollection<WriteableBitmap> _bitMapCollection = new ObservableCollection<WriteableBitmap>();
public ObservableCollection<WriteableBitmap> BitMapCollection
{
get { return _bitMapCollection; }
set { _bitMapCollection = value; }
}
WriteableBitmap photoWriteableBitMap = await new WriteableBitmap(1, 1).FromContent(new Uri("ms-appx:///Curtain1.jpg"));
WriteableBitmap frameWriteableBitMap = await new WriteableBitmap(1, 1).FromContent(new Uri("ms-appx:///Window1.jpg"));
BitMapCollection.Add(photoWriteableBitMap);
BitMapCollection.Add(frameWriteableBitMap);
The images in the flipview are blank. Nothing shows up. Is there any way ObservableCollection<WriteableBitmap>
can be bound to the XAML directly ?
I haven't tried it with
WriteableBitmap
, but below should work with standardImage
class (e.g. set the Image'sSource
to that ofphotoWriteableBitMap
and bind to a collection ofImage
)Essentially, you'd need to define a DataTemplate like so: