2

我收到有关转换为 int 的错误消息。

这是代码:

// create the object containing the page content to be set
PageData pageContent = new PageData(
    messagesPageGuid,        
    TileLayoutIndex.MessagesLayout, // Specify which layout to use for this page
    new WrappedTextBlockData(
        (Int16)TileMessagesLayoutElementId.Message1,
        "This is the text of the first message"),
    new WrappedTextBlockData(
        (Int16)TileMessagesLayoutElementId.Message2,
        "This is the text of the second message"));

这是内部枚举代码:

internal enum TileLayoutIndex
{
    MessagesLayout = 0,
};

为什么我会收到错误消息?

更新:

Guid messagesPageGuid = Guid.NewGuid();

// create the object containing the page content to be set
PageData pageContent = new PageData(
    messagesPageGuid,

这个 Guid 的东西可能是问题所在

4

1 回答 1

1

您没有使用整数,因此您需要对其进行转换:

// create the object containing the page content to be set
PageData pageContent = new PageData(
    messagesPageGuid,        
    (int)TileLayoutIndex.MessagesLayout, // Specify which layout to use for this page
于 2015-05-18T00:28:14.007 回答