Reply to thread

Hod should i organize data refreshing to make xaml data change?

Could you tell me if MediaPortal2 supports MVVM?

 

Plugin:

<Plugin

DescriptorVersion="1.0"

Name="Plugins"

PluginId="C28ABD6B-9615-4512-B8DA-A04096F35628"

Author="d2L"

Copyright="d2L"

Description="Sample plugin"

PluginVersion="0.1">

 

<Runtime>

<Assembly FileName="Plugins.dll"/>

</Runtime>

 

<Register Location="/Models">

<Model Id="5726DA5A-70D5-458f-AF67-611293D97912" Name="ViewModel" ClassName="Plugins.Models.PluginModel"/>

</Register>

 

<Register Location="/Resources/Skin">

<Resource Id="PluginsSkin" Directory="Skin" Type="Skin"/>

</Register>

 

<Register Location="/Resources/Language">

<Resource Id="PluginsLanguage" Directory="Language" Type="Language"/>

</Register>

</Plugin>

 

cs:

private AbstractProperty _country;


public AbstractProperty CountryProperty

{

get { return _country; }

}

public string Country

{

get { return (string)_country.GetValue(); }

set { _country.SetValue(value); }

}


public PluginModel()

{

  _country = new WProperty(typeof(string), null);

}


//There should be refresh after pressing on a button, but nothing happens

public void SendMessage()

{

Country="Message";

}

 

 

xaml:

<!-- Contents -->

<ControlTemplate x:Key="Contents_Template" >

<DockPanel Context="{Model Id=5726DA5A-70D5-458f-AF67-611293D97912}" LastChildFill="False">

 

 

<DockPanel.Resources>

<Model x:Key="ViewModel" Id="5726DA5A-70D5-458f-AF67-611293D97912"/>

</DockPanel.Resources>

<Button Style="{ThemeResource ButtonWideStyle}" Width="90" Margin="5,0,0,0" Command="{Command SendMessage}"></Button>

<Label Content="{Binding Path=Country, Mode=TwoWay}" />

 

</DockPanel>

</ControlTemplate>


Top Bottom