<Grid x:Name="LayoutRoot" Background="Transparent">
<!--toolkit:TiltEffect.IsTiltEnabled="True"-->
<ListBox x:Name="Channel_List" SelectionChanged="Listbox1_SelectionChanged" >
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem >
<StackPanel Width="490" MouseLeave="StackPanel_MouseLeave" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown" MouseLeftButtonUp="StackPanel_MouseLeftButtonUp">
<StackPanel.Background>
<ImageBrush ImageSource="/Assets/Images/channel-bg-unsel.png"/>
</StackPanel.Background>
<Image Source="{Binding Image}" />
<TextBlock Text="{Binding StationName}" FontFamily="Segoe Print" />
</StackPanel>
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
/////handle click events in code behind..
private void StackPanel_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var obj = (sender as StackPanel);
ImageSource img = new BitmapImage(new Uri("/Assets/Images/channel-bg-sel.png", UriKind.Relative));
ImageBrush ig = new ImageBrush();
ig.ImageSource = img;
obj.Background = ig;
//obj.Background =
}
private void StackPanel_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var obj = (sender as StackPanel);
ImageSource img = new BitmapImage(new Uri("/Assets/Images/channel-bg-unsel.png", UriKind.Relative));
ImageBrush ig = new ImageBrush();
ig.ImageSource = img;
obj.Background = ig;
}
private void StackPanel_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
{
var obj = (sender as StackPanel);
ImageSource img = new BitmapImage(new Uri("/Assets/Images/channel-bg-unsel.png", UriKind.Relative));
ImageBrush ig = new ImageBrush();
ig.ImageSource = img;
obj.Background = ig;
}
<!--toolkit:TiltEffect.IsTiltEnabled="True"-->
<ListBox x:Name="Channel_List" SelectionChanged="Listbox1_SelectionChanged" >
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem >
<StackPanel Width="490" MouseLeave="StackPanel_MouseLeave" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown" MouseLeftButtonUp="StackPanel_MouseLeftButtonUp">
<StackPanel.Background>
<ImageBrush ImageSource="/Assets/Images/channel-bg-unsel.png"/>
</StackPanel.Background>
<Image Source="{Binding Image}" />
<TextBlock Text="{Binding StationName}" FontFamily="Segoe Print" />
</StackPanel>
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
/////handle click events in code behind..
private void StackPanel_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var obj = (sender as StackPanel);
ImageSource img = new BitmapImage(new Uri("/Assets/Images/channel-bg-sel.png", UriKind.Relative));
ImageBrush ig = new ImageBrush();
ig.ImageSource = img;
obj.Background = ig;
//obj.Background =
}
private void StackPanel_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var obj = (sender as StackPanel);
ImageSource img = new BitmapImage(new Uri("/Assets/Images/channel-bg-unsel.png", UriKind.Relative));
ImageBrush ig = new ImageBrush();
ig.ImageSource = img;
obj.Background = ig;
}
private void StackPanel_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
{
var obj = (sender as StackPanel);
ImageSource img = new BitmapImage(new Uri("/Assets/Images/channel-bg-unsel.png", UriKind.Relative));
ImageBrush ig = new ImageBrush();
ig.ImageSource = img;
obj.Background = ig;
}