Showing multiple images one by one in WP7? - windows-phone-7

Which control is suitable for showing the images one by one like photo gallery in WP7?

The MetroFlow tool from the Coding4Fun Toolkit will help you accomplish that:
http://www.windowsphonegeek.com/articles/Getting-Started-with-the-Coding4Fun-toolkit-MetroFlow-Control

It really depends on how you want to stack them and where you are getting them from. For example, you could use a ListBox with a custom DataTemplate. Or you could use a StackPanel or a WrapPanel from the Silverlight Toolkit.

How about Telerik's RadSlideView control?
http://www.telerik.com/products/windows-phone/overview/all-controls.aspx#slideview

If the images are small just use StackPanel:
<StackPanel>
<Image ... />
<Image ... />
</StackPanel>
You can use ListBox as well (you will get Scrolling and Virtualization out of a box):
<ListBox>
<Image ... />
<Image ... />
</ListBox>

What I have done, is use the wrap panel control to display the thumbnails of the images in a grid, then when selecting an image, I navigate to a generic page with pretty much just a data bound pivot control with the source bound to my collection of photos. You can set the index of the pivot to whatever the index of the selected photo is in your collection and then swipe between the photos.

Related

Getting out of memory exception while loading image using 'FFImageLoading.CachedImage' in xamrinform

I want to show list of images in single page as like gallery. In my xaml page I am creating single wrap view, in that wrap view I have
add ffimageloader for loading images. Here I have gave list of image url' to that wrap view contain ffimageloader. When I called that page it shows fallowing error.
system.outofmemoryexception: out of memory at ffimageloading.platformimageloadertask..... like that. many post's suggest if we using ffimageloader instead of image tag we will reduce this type of issues but still getting same issues after using this one also. I am running my application in xamarin android. Please suggest any idea.
Here is the sample code what I have tried
<CustomWrapView x:Name="SampleGalleryView" ItemsSource="{Binding GalleryImages}">
<CustomWrapView.ItemTemplate>
<DataTemplate>
<ffimageloading:CachedImage Source="{Binding ImageUrl}" />
</DataTemplate>
</CustomWrapView.ItemTemplate>
</CustomWrapView>
Take a look at FFImageLoading's downsampling capabilities. You can read more about it here: https://github.com/luberda-molinet/FFImageLoading/wiki/Xamarin.Forms-API#downsampling-properties
If you have a lot of items, you should use some view which is capable of doing items virtualisation (I suspect that WrapView isn't), like: ListView / CarouselView, etc

How to add a button to first item in ListView

Greeting,
I'm developing an apps for Windows Phone 8.1 and face some problem with ListView.
I wanted to place a button for the FIRST item in ListView, but it seem like I can't align center the button.
Below is the code I use currently:
<ListView>
<Button Content="Jio!" Height="6" Width="362"/>
<ListViewItem Content="ListViewItem"/>
</ListView>
Adding horizontalalignment='center' just wont work for the button.
The reason I want to do this is because I wanted the button to scroll together with the list, hence I'm placing it inside the ListView.
Please advice what can I do to achieve my purpose, thanks!
I recommend using the ListView.Header content to place such a button instead of adding it as a child directly.
<ListView>
<ListView.Header>
<Button ... HorizontalAlignment="Center" />
</ListView.Header>
</ListView>
By default, the ListViewItems are left-aligned. You will eventually have to replace their Template in order to center-align it (HeaderTemplate Property).

dynamically create custom buttons in code wp7

i have a button control in code as
Button>
<Button.Content>
<StackPanel Orientation='Horizontal' >
<TextBlock Text='{Binding ramDay, Mode=TwoWay}' Margin='0,-18,0,0' Style='{StaticResource PhoneTextTitle1Style}'/>
<TextBlock Text='{Binding enDay, Mode=TwoWay}' Margin='15,10,0,0' Style='{StaticResource PhoneTextTitle2Style}'/>
</StackPanel>
</Button.Content>
</Button>
but i want to create as many buttons as user want with different values of textboxes as user want them. but i am unable to find any way, kindly help me.
thanks
Create a custom user control in you project by using this code there. Thereafter in your mainPage in the code behind add the userControl dynamically to the grid present on the UI in a for-loop or any other method which you find suitable to your situation.

Bing map on WP7

How can i display a list of positions (from a xml document:using xml reading) in a Bing map with WP7? The idea is similar to Foursquare.
Microsoft wrote a good throughout tutorial on the subject, that also explains how to use databinding, so you can do proper code and view seperation.
It all relies on instances of Pushpin that are placed on a map layer. You can see a short working sample here.
The tutorial linked by Claus nicely points out how you can use Pushpins on a BingMapsControl. If you take out the essence of the tutorial this is the piece of code you want to use. All you need is a collection of items with at least a Location attribute. If you want your Pushpin to have a label you can also add a Name attribute.
You can databind the collection of items to your mapcontrol by adding this piece of code within your BingMapsControl.
<maps:MapItemsControl ItemsSource="{Binding Items}" >
<maps:MapItemsControl.ItemTemplate>
<DataTemplate>
<maps:Pushpin Content="{Binding Name}" Location="{Binding Location}"/>
</DataTemplate>
</maps:MapItemsControl.ItemTemplate>
</maps:MapItemsControl>
If you need any more explanation please refer to the tutorial mentioned by Claus

Generating and displaying images in grid in Silverlight

I want to develop an webpage like Google Images in Silverlight.
The difference is the images are generated from my DSL.
The webpage shows different images in grid and allows users to pick one.
The webpage then shows similar images to this.
Should I use Grid panel or DataGrid? And how do I handle double click on cells?
Should I generate my DSL to Shapes or Image? What are the pros and cons?
Thanks.
This is actually pretty simple, all you need to do is use a data template for the column in your datagrid.
<sdk:DataGrid.Columns>
<sdk:DataGridTemplateColumn Width="80">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Width="240" Height="180" Source="http://www.yourimage.com/images/myimage.png" />
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
Optional: If you need to change the image via code rather than inline like this then in place of the Image XAML element put a stackpanel that calls a function in your code-behind, which returns an image.
<StackPanel Loaded="StackPanel_Loaded"></StackPanel>

Resources