The problem with using the controls in the skin

Discussion in 'Plugin Development' started by d2Liks, February 22, 2012.

  1. d2Liks

    d2Liks New Member

    Joined:
    February 22, 2012
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 0
    Home Country:
    Ukraine Ukraine
    How to use in the MediaPortal in the skin listbox control?
    How do I use to bind to the listview? These do not appear in it.


     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    I don't understand your question.
    To learn about data binding, you can read http://msdn.microsoft.com/en-us/library/ms752347.aspx
    To bind a ListView to underlaying data, you need a data model.
    You can look into the screens of the default skin to see how we use the ListView. Look into the code of the referenced models to see how a model is written.
     
  4. d2Liks

    d2Liks New Member

    Joined:
    February 22, 2012
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 0
    Home Country:
    Ukraine Ukraine
    <Include.Resources>
    <!-- Header -->
    <Model x:Key="Model" Id="5726DA5A-70D5-458f-AF67-611293D97912"/>
    <DockPanel Context="{Model Id=5726DA5A-70D5-458f-AF67-611293D97912}" LastChildFill="False">

    <ListView Width="200" Height="300"
    x:Name="Menu"
    DataContext="{Binding Source={StaticResource Model}}"
    ItemsSource="{Binding GetContacts}"
    Style="{ThemeResource ContentsMenuListViewStyle}">

    </ListView>

    </DockPanel>
    </ControlTemplate>

    </Include.Resources>
    </Include>

    Hi, my problem is that accessor get function in GetContacts property works correctly but ListView still doesn't show anything. Where is the problem here?

    Here is how implemented my property:

    private ItemsList _listContacts=null;
    public ItemsList GetContacts
    {
    get
    {
    return _listContacts;
    }
    set
    {
    if (_listContacts == value) return;
    _listContacts = value;
    OnPropertyChanged("GetContacts");
    }
    }
     
  5. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    That seems well, as far as I can see.
    One of Context/DataContext is obsolete in your example, they both assign the same data context and it is inherited to child elements.

    Is the model you're using registered in the plugin.xml file?
    Which items are in the ItemsList which is returned by GetContacts? Btw, you should name the property Contacts, not GetContacts.
     
  6. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    Oh, I missed something: Your DockPanel doesn't contain a key. I guess you're using one of the templates master_bare or master_menu for your include. Depending on that template, you must assign an appropriate key to your DockPanel, see the description in the template screen you're using.
     
  7. d2Liks

    d2Liks New Member

    Joined:
    February 22, 2012
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 0
    Home Country:
    Ukraine Ukraine
    Could you give an example of adding rows to ListView (how to implement String property which is linked to itemsSource ListView). This property returns a list of simple strings.

    I would like to ask few more questions.

    How do I make property password in MediaPortal2 to keep data secret while entering the text into textBox like in WPF PasswordBox ?

    How do I implement Visible property correctly? If I make property for texBox this way it will be ignored.

    private AbstractProperty _registrContentVisibility;

    public Plugin()
    {
    _registrContentVisibility = new WProperty(typeof(Visibility), null);
    RegistrContentVisibility = Visibility.Collapsed;
    }

    public AbstractProperty RegistrContentVisibilityProperty
    {
    get { return _registrContentVisibility; }
    }

    public Visibility RegistrContentVisibility
    {
    get { return (Visibility)_registrContentVisibility.GetValue(); }
    set { _registrContentVisibility.SetValue(value); }
    }


    <TextBox Visibility="{Binding Path= RegistrContentVisibility , Mode=TwoWay}">
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!