Skip to content

Instantly share code, notes, and snippets.

View wtuts's full-sized avatar

Windows App Tutorials wtuts

View GitHub Profile
@wtuts
wtuts / list1.xaml
Created June 23, 2014 13:51
Data binding in listbox
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="Listbox Databinding" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
<TextBlock Text="Listbox" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
@wtuts
wtuts / list2.xaml
Last active August 29, 2015 14:02
Data binding in a list box
<ListBox x:Name="mylistbox">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="52" Width="auto">
<TextBlock x:Name="nameblock" Text="{Binding name}" HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Height="41" Width="331" FontSize="30" Margin="10,0,0,0" />
<TextBlock x:Name="marksblock" Text="{Binding marks}" HorizontalAlignment="Left" Margin="391,0,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="41" Width="55" FontSize="30" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
@wtuts
wtuts / sampledata.cs
Created June 23, 2014 15:36
Data binding in listbox
//Sample data to be used in the listbox
string[] studentnames = new string[8] { "Aalap", "Alex", "Aman", "Bharat", "Chetan", "Chitransh", "Vaibhav", "Vivek" };
int[] studentmarks = new int[8] { 82, 78, 84, 56, 98, 94, 95, 97 };
@wtuts
wtuts / firstmethod.cs
Created June 23, 2014 15:36
Data binding in listbox
public void firstmethod()
{
//create a list of Resultclass
List<Resultclass> mylist = new List<Resultclass>();
for (int i = 0; i < 8; i++)
{
//Create a new object of Result class
Resultclass obj = new Resultclass();
@wtuts
wtuts / Secondmethod.cs
Created June 23, 2014 15:37
Databinding in listbox
public void secondmethod()
{
for (int i = 0; i < 8; i++)
{
//Create a new object of Result class
Resultclass obj = new Resultclass();
//add the corresponding data from the sample array
obj.name = studentnames[i];
obj.marks = studentmarks[i];
@wtuts
wtuts / Resultclass.cs
Created June 23, 2014 18:49
Databinding in listbox
//Public class
public class Resultclass
{
public string name { get; set; }
public int marks { get; set; }
}
@wtuts
wtuts / Hub1.xaml
Created June 24, 2014 18:36
Hub tiles - Part 2
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="Listbox Databinding" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
<TextBlock Text="Hub tiles" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
@wtuts
wtuts / Hub2.xaml
Last active August 29, 2015 14:02
Hub tiles -Part 2
<ListBox x:Name="mylistbox" Margin="10,0,0,97">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Height="190" Width="190" HorizontalAlignment="Left" VerticalAlignment="Top">
<toolkit:HubTile Title="{Binding title}" Notification="{Binding notification}" Source="{Binding source}" GroupTag="{Binding tag}" Height="173" Width="173" Margin="0,8,0,0" />
@wtuts
wtuts / Hub3.cs
Created June 24, 2014 19:16
Hub tiles -Part 2
//Tile class so as to provide data source for the mylistbox
public class Tileclass
{
public string title { get; set; }
public string notification { get; set; }
public string source { get; set; }
public string tag { get; set; }
}
@wtuts
wtuts / Hub4.cs
Created June 24, 2014 19:25
Hub tiles -Part 2
//Arrays to provide sample data
string[] arrayoftitle = new string[6] {"Flipkart","Snapdeal","Jabong","ebay","Amazon","HD" };
string[] arrayofnotification = new string[6] { "Notify 1", "Notify 2", "Notify 3", "Notify 4", "Notify 5", "Notify 6" };
string[] imagesource = new string[6] { "1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg" };
//The above sample images have been added into a folder called images in the project file