0

Hey all I am trying to make my own movie poster menu using WPF. So far its good but has a few issues that I would like help clearing up.

For starters, here is my code:

<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:scrollView"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <ListView x:Name="TvBox" HorizontalAlignment="Stretch" VerticalAlignment="Top" IsTextSearchEnabled="False" SelectionMode="Single" UseLayoutRounding="True">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <UniformGrid Columns="5" HorizontalAlignment="Stretch"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ListView.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="{Binding ImageData}" HorizontalAlignment="Stretch" VerticalAlignment="Top" Stretch="UniformToFill" Width="150">
                        <Image.Effect>
                            <DropShadowEffect BlurRadius="20" ShadowDepth="0" Opacity="0.5"/>
                        </Image.Effect>
                        <Image.Style>
                    </Image>
                    <TextBlock Text="{Binding Title}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
                </StackPanel>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>    
</Window>

And the code behind looks like this:

Class MainWindow
    Public Class MovieData
        Private _Title As String
        Private _ImageData As BitmapImage

        Public Property Title() As String
            Get
                Return Me._Title
            End Get
            Set
                Me._Title = Value
            End Set
        End Property

        Public Property ImageData() As BitmapImage
            Get
                Return Me._ImageData
            End Get
            Set
                Me._ImageData = Value
            End Set
        End Property
    End Class
    Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        Me.TvBox.ItemsSource = New MovieData() {New MovieData() With {
            .Title = "Movie 1",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box1.jpg"))
        }, New MovieData() With {
            .Title = "Movie 2",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box2.jpg"))
        }, New MovieData() With {
            .Title = "Movie 3",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box3.jpg"))
        }, New MovieData() With {
            .Title = "Movie 4",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box4.jpg"))
        }, New MovieData() With {
            .Title = "Movie 5",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box5.jpg"))
        }, New MovieData() With {
            .Title = "Movie 6",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box6.jpg"))
        }, New MovieData() With {
            .Title = "Movie 7",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box7.jpg"))
        }, New MovieData() With {
            .Title = "Movie 8",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box8.jpg"))
        }, New MovieData() With {
            .Title = "Movie 9",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box9.jpg"))
        }, New MovieData() With {
            .Title = "Movie 10",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box10.jpg"))
        }, New MovieData() With {
            .Title = "Movie 11",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box11.jpg"))
        }, New MovieData() With {
            .Title = "Movie 12",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box12.jpg"))
        }, New MovieData() With {
            .Title = "Movie 13",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box13.jpg"))
        }, New MovieData() With {
            .Title = "Movie 14",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box14.jpg"))
        }, New MovieData() With {
            .Title = "Movie 15",
            .ImageData = GetBitmapImage(New Uri("C:\Users\someone\Pictures\box15.jpg"))
        }}
    End Sub

    Public Function GetBitmapImage(imageAbsolutePath As Uri, Optional bitmapCacheOption__1 As BitmapCacheOption = BitmapCacheOption.[Default]) As BitmapImage
        Dim image As New BitmapImage()
        image.BeginInit()
        image.CacheOption = bitmapCacheOption__1
        image.UriSource = imageAbsolutePath
        image.EndInit()

        Return image
    End Function
End Class

All that above produces the following:

enter image description here

The issues I am running into:

enter image description here

Notice the highlight around the poster? The light blue color? How can I turn that off but still be able to use the up/down/left/right arrows to choose a poster?

Addition to the above, when I have it highlighted (the light blue color surronding the poster) I would like the poster selected to come toward the user (I call this zooming). Is this possible to do with WPF?

StealthRT
  • 10,108
  • 40
  • 183
  • 342

0 Answers0