- January 3, 2008
- 890
- 556
- Home Country
- Germany
- Thread starter
- Moderator
- #11
Albert,
with your help i got my first listitem skin working. It does everything i want for focusing and clicking on an item, but throws an exception in the log file
whenever I change the focus of an item.
I am using now "Name" and Style="{ThemeResource MenuListViewStyle}" which results in a nice list item menu list.
whenever I change the focus the following function is executed correctly:
public void FocusedItemChanged(ListItem focusedListItem)
{
if (focusedListItem == null)
return;
mylogger.Debug("FocusedItemChanged: Focused item=" + focusedListItem.Labels["Name"]);
//update label
FocusedItem = LocalizationHelper.Translate(FOCUSED_ITEM_RESOURCE, focusedListItem.Labels["Name"]);
mylogger.Debug("FocusedItemChanged: Completed");
}
However, after "FocusedItemChanged: Completed" it throws an exception
[2012-04-07 20:29:19,112] [12236 ] [InputMgr ] [DEBUG] - FocusedItemChanged: Completed
[2012-04-07 20:29:19,125] [12249 ] [InputMgr ] [ERROR] - CommandBaseMarkupExtension: Error executing command '{CommandStencil Source=MyTestPlugin.Models.MyTestPluginScreen2,Path=FocusedItemChanged}'
System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei MyTestPlugin.Models.MyTestPluginScreen2.FocusedItemChanged(ListItem focusedListItem)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
bei System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei MediaPortal.UI.SkinEngine.MarkupExtensions.CommandBaseMarkupExtension.Execute(IEnumerable`1 parameters)
My screen file is:
<Include.Resources>
<!-- Header -->
<ResourceWrapper x:Key="Header_Text" Resource="[MyTestPluginScreen2.ScreenTitle]"/>
<!-- SlimTvClient model -->
<Model x:Key="MyTestPluginScreen2" Id="cefc2f41-8a0d-4f92-b2e7-c7fa2194e90d"/>
<!-- Contents -->
<ControlTemplate x:Key="Contents_Template">
<DockPanel Context="{Model Id=cefc2f41-8a0d-4f92-b2e7-c7fa2194e90d}" LastChildFill="False">
<Label Content="{Binding FocusedItem}" Color="{ThemeResource TextColor}" FontSize="22" DockPanel.Dock="Top" HorizontalAlignment="Left"/>
<Label Content="{Binding SelectedItem}" Color="{ThemeResource TextColor}" FontSize="22" DockPanel.Dock="Top" HorizontalAlignment="Left"/>
<ListView Name="TestListView" DockPanel.Dock="Center" Height="300" Width="600" ItemsSource="{Binding MyListViewItems}" SelectionChanged="{CommandStencil Source={StaticResource MyTestPluginScreen2}, Path=FocusedItemChanged}" Style="{ThemeResource MenuListViewStyle}">
<ListView.Resources>
<CommandBridge x:Key="Menu_Command" Command="{Binding Path=Command,Mode=OneTime}"/>
</ListView.Resources>
</ListView>
</DockPanel>
</ControlTemplate>
</Include.Resources>
Any idea what could causing this?
with your help i got my first listitem skin working. It does everything i want for focusing and clicking on an item, but throws an exception in the log file
whenever I change the focus of an item.
I am using now "Name" and Style="{ThemeResource MenuListViewStyle}" which results in a nice list item menu list.
whenever I change the focus the following function is executed correctly:
public void FocusedItemChanged(ListItem focusedListItem)
{
if (focusedListItem == null)
return;
mylogger.Debug("FocusedItemChanged: Focused item=" + focusedListItem.Labels["Name"]);
//update label
FocusedItem = LocalizationHelper.Translate(FOCUSED_ITEM_RESOURCE, focusedListItem.Labels["Name"]);
mylogger.Debug("FocusedItemChanged: Completed");
}
However, after "FocusedItemChanged: Completed" it throws an exception
[2012-04-07 20:29:19,112] [12236 ] [InputMgr ] [DEBUG] - FocusedItemChanged: Completed
[2012-04-07 20:29:19,125] [12249 ] [InputMgr ] [ERROR] - CommandBaseMarkupExtension: Error executing command '{CommandStencil Source=MyTestPlugin.Models.MyTestPluginScreen2,Path=FocusedItemChanged}'
System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei MyTestPlugin.Models.MyTestPluginScreen2.FocusedItemChanged(ListItem focusedListItem)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
bei System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei MediaPortal.UI.SkinEngine.MarkupExtensions.CommandBaseMarkupExtension.Execute(IEnumerable`1 parameters)
My screen file is:
<Include.Resources>
<!-- Header -->
<ResourceWrapper x:Key="Header_Text" Resource="[MyTestPluginScreen2.ScreenTitle]"/>
<!-- SlimTvClient model -->
<Model x:Key="MyTestPluginScreen2" Id="cefc2f41-8a0d-4f92-b2e7-c7fa2194e90d"/>
<!-- Contents -->
<ControlTemplate x:Key="Contents_Template">
<DockPanel Context="{Model Id=cefc2f41-8a0d-4f92-b2e7-c7fa2194e90d}" LastChildFill="False">
<Label Content="{Binding FocusedItem}" Color="{ThemeResource TextColor}" FontSize="22" DockPanel.Dock="Top" HorizontalAlignment="Left"/>
<Label Content="{Binding SelectedItem}" Color="{ThemeResource TextColor}" FontSize="22" DockPanel.Dock="Top" HorizontalAlignment="Left"/>
<ListView Name="TestListView" DockPanel.Dock="Center" Height="300" Width="600" ItemsSource="{Binding MyListViewItems}" SelectionChanged="{CommandStencil Source={StaticResource MyTestPluginScreen2}, Path=FocusedItemChanged}" Style="{ThemeResource MenuListViewStyle}">
<ListView.Resources>
<CommandBridge x:Key="Menu_Command" Command="{Binding Path=Command,Mode=OneTime}"/>
</ListView.Resources>
</ListView>
</DockPanel>
</ControlTemplate>
</Include.Resources>
Any idea what could causing this?