- March 24, 2007
- 12,073
- 7,459
- Home Country
- Germany
- Moderator
- #301
I will check the questions soon, but now dinner
<Grid
xmlns="www.team-mediaportal.com/2008/mpf/directx"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:collections="clr-namespace:MediaPortal.UI.Presentation.DataObjects;assembly=MediaPortal.UI"
>
<Grid.Resources>
<Model x:Key="CurrentWeatherModel" Id="FC57FF5C-F72F-47E9-B973-338E31FF7FF1"/>
<Model x:Key="LatestMediaModel" Id="19FBB179-51FB-4DB6-B19C-D5C765E9B870"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" DataContext="{Binding Source={StaticResource LatestMediaModel}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListView x:Name="MasterList" ItemsSource="{Binding Videos}" Style="{ThemeResource MediaItemsListListViewStyle}">
</ListView>
</Grid>
<StackPanel Grid.Row="1" Grid.Column="1" >
<Image x:Name="SmallIcon" Source="{Binding Source={StaticResource CurrentWeatherModel}, Path=CurrentLocation.Condition.BigIconProperty}"
IsVisible="{Binding UseInHome}" HorizontalAlignment="Center" Margin="0,0,0,0"/>
<Label x:Name="Temp" Content="{Binding Source={StaticResource CurrentWeatherModel}, Path=CurrentLocation.Condition.Temperature}"
FontFamily="TitanBold" Color="{ThemeResource TextColor}" IsVisible="{Binding UseInHome}"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Label x:Name="Place" Content="{Binding Source={StaticResource CurrentWeatherModel}, Path=CurrentLocation.Name}"
FontFamily="TitanBold" Color="{ThemeResource TextColor}" IsVisible="{Binding UseInHome}"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
Watch out for:
- New ModelId (LatestMedia)
- New Source for ListView (Videos here)
- You copied FontNames from Titanium (TitanBold) which do not match to ApolloOne skin. Maybe remove them at all (fallback to default) or specify a valid one
- You need to create matching ListView Styles for Videos, Series, etc. because the default styles depend on Media plugin for view mode selection (which we don't need here but use one style)
<Style x:Key="MediaItemsListListViewStyle_BV" BasedOn="{ThemeResource ContentsMenuListViewStyle}">
<Setter Property="ItemTemplate"/> <!-- Don't inherit the ItemTemplate from ContentsMenuListViewStyle - It should remain null to make the SkinEngine choose an appropriate template -->
<Setter Property="DataStringProvider" Value="{ThemeResource MediaItemDataStringProvider}"/>
<Setter Property="ItemContainerStyle" Value="{ThemeResource MediaItemWithContextMenuContainerStyle}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
<ScrollViewer CanContentScroll="True" Margin="5"
HorizontalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
<BindingSetter Property="ItemsPanel">
<BindingSetter.BindingWrapper>
<BindingWrapper>
<BindingWrapper.Binding>
<Binding.Source>
<ItemsPanelTemplate>
<VirtualizingWrapPanel x:Name="GridItemsHost" IsItemsHost="True"/>
</ItemsPanelTemplate>
</Binding.Source>
</BindingWrapper.Binding>
</BindingWrapper>
</BindingSetter.BindingWrapper>
</BindingSetter>
</Style>
<!-- Latest media styles -->
<Model x:Key="MediaModel" Id="19FBB179-51FB-4DB6-B19C-D5C765E9B870"/>
<Style x:Key="LatestMediaListViewStyle_BV" BasedOn="{ThemeResource MediaItemsListListViewStyle_BV}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<UniformGrid x:Name="ListItemsHost" Columns="2" IsItemsHost="True" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="NestedMediaListDataTemplate_BV" DataType="{x:Type collections:ListItem}">
<StackPanel>
<Label Content="{Binding [Name]}" Color="{ThemeResource TextColor}" />
<ListView x:Name="MediaItemsList" Style="{ThemeResource LatestMediaListViewStyle_BV}" ItemsSource="{Binding Items}"
HorizontalAlignment="Stretch">
<ListView.Resources>
<Command x:Key="Menu_Command" Source="{StaticResource MediaModel}"
Path="Select" Parameters="{LateBoundValue BindingValue={Binding}}"/>
</ListView.Resources>
</ListView>
</StackPanel>
</DataTemplate>
<Style x:Key="NestedMediaListViewStyle_BV" BasedOn="{ThemeResource DefaultListViewStyle}">
<Setter Property="ItemTemplate" Value="{ThemeResource NestedMediaListDataTemplate_BV}"/>
</Style>
Sorry. Typical copy & paste error due to less time. It's fixed now.The audio part from the LatestMediaModel seems to take also series, only the style is correct.
I decreased the update interval to 30sec. The problem with your idea is, that the (actual) home screen is always activated. The HomeMenuModel could post update request messages to LatestMediaModel if the "home tab" (not the whole screen) get's selected. This can be done later if really required, but for now I'd go the simpler route.I think it would be better to switch off the refreshing every 10 seconds. The items are flickering. It would be enough, if the items are only loaded when the home screen is activated