3

次のデフォルトのテンプレートとは異なり、Windows8グリッドアプリのいくつかのアイテムをカスタマイズしたいと思います。

SampleDataItem(文字列uniqueId、文字列タイトル、文字列サブタイトル、文字列imagePath、文字列の説明、文字列コンテンツ、SampleDataGroupグループ)

一部のdataItemには、mediaElementやアニメーションなどのUIコントロールを追加したいと思います。他の人にとっては、私はしません。

そのような問題に対処するための可能な方法はありますか?

前もって感謝します。

4

1 に答える 1

0

新しいカスタムコンストラクターを使用するには、Baseの新しいコンストラクターを作成する必要があります。このような:

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;
    }
}

そして今、グリッドアイテムを作成するために、この新しいコンストラクターを新しいカスタムクラス(または既存のクラス)に呼び出す必要があります。

  • 私の英語はとても下手です、ごめんなさい!
于 2013-04-03T14:23:04.843 に答える