C# 在Windows 8 metro中从Viewmodel设置字符串样式

C# 在Windows 8 metro中从Viewmodel设置字符串样式,c#,string,mvvm,windows-8,C#,String,Mvvm,Windows 8,我正在为我的项目遵循MVVM模式,并希望将字符串属性绑定到TextBlock文本属性 用户已完成调查 我不知道如何在viewmodel中实现这种多色字符串。 我希望这应该发生在viewmodel中,因为此消息取决于条件。您可以使用Run属性 非mvvm 用户 已完成 调查 或者Mvvm,您可以让视图模型格式化字符串,然后只绑定到相关属性 <TextBlock> <Run Text={Binding your_mvvm_propert

我正在为我的项目遵循MVVM模式,并希望将字符串属性绑定到TextBlock文本属性

用户已完成调查

我不知道如何在viewmodel中实现这种多色字符串。
我希望这应该发生在viewmodel中,因为此消息取决于条件。

您可以使用Run属性

非mvvm

用户
已完成
调查
或者Mvvm,您可以让视图模型格式化字符串,然后只绑定到相关属性

 <TextBlock>            
        <Run Text={Binding your_mvvm_property}"  Foreground="{StaticResource your_style"/>
        <Run Text={Binding your_mvvm_property2}"  Foreground="{StaticResource your_style2"/>
    </TextBlock>

 <TextBlock>            
        <Run Text={Binding your_mvvm_property}"  Foreground="{StaticResource your_style"/>
        <Run Text={Binding your_mvvm_property2}"  Foreground="{StaticResource your_style2"/>
    </TextBlock>