Customizing each item in a Windows 8 screen app template

I would like to customize some elements in a Windows 8 Grid application, as opposed to the default template which looks like this:

SampleDataItem (String uniqueId, String title, String subtitle, String imagePath, String description, String content, SampleDataGroup group)

For some data elements, I would like to add some UI elements like mediaElement or animations. For others, I don’t.

Is there any possible way to deal with such a problem?

Thanks in advance.

+3


source to share


1 answer


You need to create a new constructor for Base in order to use the new custom constructor. Like this:

public abstract class SampleDataCommon : PrototypeCeA.Common.BindableBase
{
    private static Uri _baseUri = new Uri("ms-appx:///");
//Base constructor

    public SampleDataCommon(String uniqueId, String title, String subtitle, String imagePath, SolidColorBrush Background)
    {
        this._uniqueId = uniqueId;
        this._title = title;
        this._subtitle = subtitle;
        this._imagePath = imagePath;
        this._background = Background;
    }

    // new customized constructor
    public SampleDataCommon(String uniqueId, String title, String subtitle, bitmapImage image, String description, String Author)
    {
        this._uniqueId = uniqueId;
        this._title = title;
        this._subtitle = subtitle;
        this._description = description;
        this._image = image;
        this._author = author;
    }
}

      



And now you need to call this new constructor on a new custom class (or existing class) to populate the grid item.

  • My English is very bad, sorry!
0


source







All Articles