Skip to content

Instantly share code, notes, and snippets.

@clausjoergensen
Created October 4, 2011 17:46
Show Gist options
  • Save clausjoergensen/1262289 to your computer and use it in GitHub Desktop.
Save clausjoergensen/1262289 to your computer and use it in GitHub Desktop.
<ListBox ItemsSource="{Binding Tiles}" SelectionChanged="ListBox_SelectionChanged">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<toolkit:HubTile Title="{Binding Author}"
Margin="3"
Message="{Binding Name}"
Notification="{Binding Rating}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var listbox = sender as ListBox;
if (listbox.SelectedIndex != -1)
{
var tile = listbox.SelectedItem as Tile;
System.Diagnostics.Debug.WriteLine(tile.Author);
listbox.SelectedIndex = -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment