- July 25, 2010
- 4,024
- 1,420
- Home Country
- Germany
@morpheus_xx
I thought I would start working on a little Inputmanager, because this is requested by many people
It is a bit how you doing, but anyway^^
First problem:
I can add Items to the Listview and the Items shown, but without any text I tried to read in other plugins, but I think I did it exactly the same, but it just doesn't work :/
See attached Screenshot.
The code looks liek this:
And the creation of the ListItems:
The second Issue is that I get the following message:
The code:
This is how I generate the items (you are probably screaming how I select the properties from "Key"
I thought I would start working on a little Inputmanager, because this is requested by many people
It is a bit how you doing, but anyway^^
First problem:
I can add Items to the Listview and the Items shown, but without any text I tried to read in other plugins, but I think I did it exactly the same, but it just doesn't work :/
See attached Screenshot.
The code looks liek this:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Include
xmlns="www.team-mediaportal.com/2008/mpf/directx"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Source="screens\master_menu.xaml"
>
<Include.Resources>
<ControlTemplate x:Key="Contents_Template">
<Grid>
<!-- Model = MediaNavigationModel -->
<Grid.Resources>
<Model x:Key="MediaModel" Id="CC11183C-01A9-4F96-AF90-FAA046981006"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsVisible="true">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListView Context="{Model Id=CC11183C-01A9-4F96-AF90-FAA046981006}" Style="{StaticResource ContentsMenuListViewStyle}" ItemsSource="{Binding Path=Items,Mode=OneTime}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsVisible="true">
<ListView.Resources>
<!--<Command x:Key="Menu_Command" Source="{StaticResource MediaModel}" Path="Select"
Parameters="{LateBoundValue BindingValue={Binding}}"/>-->
<CommandBridge x:Key="Menu_Command" Command="{Binding Path=Command,Mode=OneTime}"/>
</ListView.Resources>
</ListView>
<Button Context="{Model Id=CC11183C-01A9-4F96-AF90-FAA046981006}" Content="Add" Style="{ThemeResource ButtonWideStyle}" Margin="10"
HorizontalAlignment="Right" VerticalAlignment="Center"
Command="{Command AddKeyMapping}"/>
</Grid>
</Grid>
</ControlTemplate>
</Include.Resources>
</Include>
And the creation of the ListItems:
Code:
protected ItemsList _items;
public ItemsList Items
{
get { return _items; }
}
private void InitModel()
{
_items = new ItemsList();
[....]
var tmp = new ListItem();
tmp.SetLabel("asdda", "sadas");
tmp.SetLabel("dsfsdf", "adsadsda");
tmp.SetLabel("dsadsa", "asdasfds");
//tmp.Command = new MethodDelegateCommand(() => ChooseKeyAction(someString));
_items.Add(tmp);
_items.Add(new ListItem("cdgdfgdfgdfgdfg", "ddgdfgdfg"));
_items.FireChange();
}
The second Issue is that I get the following message:
[2015-09-25 13:26:37,722] [56639 ] [InputMgr ] [WARN ] - CommandBaseMarkupExtension: Could not find method, could not execute command ({Command Source=MediaPortal.Plugins.Inputmanager.Models.ConfigScreen,Path=Select})
The code:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Include
xmlns="www.team-mediaportal.com/2008/mpf/directx"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Source="screens\master_menu.xaml"
>
<Include.Resources>
<ControlTemplate x:Key="Contents_Template">
<Grid>
<!-- Model = MediaNavigationModel -->
<Grid.Resources>
<Model x:Key="MediaModel" Id="CC11183C-01A9-4F96-AF90-FAA046981006"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsVisible="true">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListView Context="{Model Id=CC11183C-01A9-4F96-AF90-FAA046981006}" Style="{StaticResource ContentsMenuListViewStyle}" ItemsSource="{Binding Path=ActionItems,Mode=OneTime}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsVisible="true">
<ListView.Resources>
<Command x:Key="Menu_Command" Source="{StaticResource MediaModel}" Path="Select"
Parameters="{LateBoundValue BindingValue={Binding}}"/>
</ListView.Resources>
</ListView>
<Button Context="{Model Id=CC11183C-01A9-4F96-AF90-FAA046981006}" Content="Finish" Style="{ThemeResource ButtonWideStyle}" Margin="10"
HorizontalAlignment="Right" VerticalAlignment="Center"
Command="{Command AddKeyFinish}"/>
</Grid>
</Grid>
</ControlTemplate>
</Include.Resources>
</Include>
This is how I generate the items (you are probably screaming how I select the properties from "Key"
Code:
_actionItems = new ItemsList();
foreach (var property in typeof(Key).GetFields())
{
var listItem = new ListItem(property.Name, property.Name);
listItem.Command = new MethodDelegateCommand(() => ChooseKeyAction(property.Name));
_actionItems.Add(listItem);
ServiceRegistration.Get<ILogger>().Info("Action: {0}", property.Name);
}