0

我有这个为 Windows 商店应用程序 FlipView 自动生成的 FlipView

<common:RichTextColumns x:Name="richTextColumns" Margin="117,0,117,47">
    <RichTextBlock x:Name="richTextBlock" Width="560" Style="{StaticResource ItemRichTextStyle}" IsTextSelectionEnabled="False">
        <Paragraph>
            <Run FontSize="26.667" FontWeight="Light" Text="{Binding Title}"/>
            <LineBreak/>
            <LineBreak/>
            <Run FontWeight="Normal" Text="{Binding Subtitle}"/>
        </Paragraph>
        <Paragraph LineStackingStrategy="MaxHeight">
            <InlineUIContainer>
                <Image x:Name="image" MaxHeight="480" Margin="0,20,0,10" Stretch="Uniform" Source="{Binding Image}" AutomationProperties.Name="{Binding Title}"/>
            </InlineUIContainer>
        </Paragraph>
        <Paragraph>
            <Run FontWeight="SemiLight" Text="{Binding Content}"/>
        </Paragraph>
    </RichTextBlock>

我需要将它与这个类绑定

public class InPageDesc
{
    private string title;
    private string subtitle;
    private Image image;
    private string content;

    public string Title
    { 
        get
        {
            return this.title;
        }
        set
        {
             this.title = value;
        }
    }
    public string Subtitle
    {
        get
        {
            return this.subtitle;
        }
        set
        {
            this.subtitle = value;
        }
    }
    public Image Image
    {
        get
        {
            return this.image;
        }
        set
        {
            this.image = value;
        }
    }
    public string Content
    {
        get
        {
            return this.content;
        }
        set
        {
            this.content = value;
        }
    }
}

但它总是给我这个错误“值不在预期范围内”。我的代码有什么问题?

4

1 回答 1

1

在您的班级InPageDesc中-> 不要将图像存储为Image,而是将其路径存储为string.

例如公共字符串 Image = "Assets/Images/Image1.jpg"

这对我有用。

于 2013-07-09T07:23:52.727 回答