windows - 自定义 Windows 8 网格应用程序模板中的每个项目

标签 windows grid

我想自定义 Windows 8 Grid App 中的一些项目,与以下默认模板不同:

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

对于某些数据项,我想添加一些 UI 控件,例如 mediaElement 或动画。对于其他人,我没有。

有什么办法可以解决这个问题吗?

提前致谢。

最佳答案

您需要为 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;
    }
}

现在,您需要将这个新的构造函数调用到一个新的自定义类(或现有类)中以填充您的网格项。

  • 我的英语很差,抱歉!

关于windows - 自定义 Windows 8 网格应用程序模板中的每个项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14614013/

相关文章:

windows - 在更新之前删除现有的 Go 安装?

c++ - 调用 GetDisplayName 返回与 GetIconPath 相同的结果

Python33, flask : Lot of Errors starting Hello World

c++ - 构建两个相互依赖的dll

c# - 访问 GridCheckboxColumn

grid - 实现双向GridLSTM

c++ - 直接显示捕获过滤器 "wrapper"

c# - WPF - 通过调整大小在窗口中调整控件大小

css - 使用 CSS 网格移动特定的 <td> 元素?

silverlight - 在 Silverlight 3 中使用网格作为 ItemsControl 的 ItemsPanel