Reply to thread

AW: HOW TO: Create a simple media list interface


Now I got time to test it.


If you use mouse scrolling, it works in any case.

If you want to use keyboard scrolling, you need to set Focusable="True" at the ListViewitems or at the ItemsHost panel (not at the ListView, sorry, that was wrong).


I use this screen for the test:


[CODE]

<Screen

    xmlns="www.team-mediaportal.com/2008/mpf/directx"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <DockPanel LastChildFill="False">

    <ListView Background="Yellow" Width="300" Height="300" DockPanel.Dock="Center"

        HorizontalAlignment="Center" VerticalAlignment="Center">

      <ListViewItem Focusable="True">

        <WrapPanel>

          <Image Margin="0,0,14,0" Source="viewed.png" />

          <Image VerticalAlignment="Bottom"  Margin="0,0,14,0" Source="divx.png" />

          <Label Content="Choix 1"/>

        </WrapPanel>

      </ListViewItem>

      <ListViewItem Focusable="True">

        <WrapPanel>

          <Image Width="30" Margin="0,0,14,0" Source="inprogress.png" />

          <Image VerticalAlignment="Bottom"  Margin="0,0,14,0" Source="dvd.png" />

          <Label Content="Choix 1"/>

        </WrapPanel>

      </ListViewItem>

    </ListView>

  </DockPanel>

</Screen>

[/CODE]


Note that the size of the ListViewItems in relation to the ItemsHost panel of the ListView is important: The ListViewItems are contained in the ItemsHost panel, which is a StackPanel in the default ListView style. StackPanels cannot show items which are bigger than their own size in MP2. That's due to our limitation we cannot clip the children to the StackPanel's bounds. If we would show elements inside a StackPanel which are bigger than the panel, the elements would take more space than the StackPanel.


So take care that in every scroll position, at least one complete ListViewItem can be shown by the StackPanel.


Alternatively to show ListViewItems which are bigger than your ListView, you can set CanContentScroll="False" on the ScrollViewer which is used in the ListView style. But to do that, you need to set a custom style.


The reason why the scrolling is so difficult in MP2 is because when you don't use a mouse, the only means to trigger the scrolling is the keyboard arrows. And those keys only can work on a control which has keyboard focus. If the ScrollViewer wouldn't check the keyboard focus and you had more than one ScrollViewer in your screen, all ScrollViewers would scroll at the same time.


Top Bottom