场景:使用c#发往Windows 8.1/10(商店应用程序)的桌面,在UWP中开发"胖"客户端.
在我的用户界面中,我尝试使用以下内联
<StackPanel Grid.Column="0">
<TextBlock x:Name="Qty_Size_Crust" Margin="25,10,20,0" Padding="0,0,0,0" TextAlignment="Left" TextWrapping="Wrap" MaxHeight="25" Foreground="#ff230909" FontFamily="Segoe UI" FontSize="16" xml:space="preserve" HorizontalAlignment="Left">
if ({Binding WidgetName} == "Backend")
{
<Run Text="{Binding ItemCode, Converter=ItemCodeToDescriptionConverter}"/>
}
else
{
<Run Text="See Administrator}"/>
}
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
编译器会接受这个,但在执行期间,我既看不到项目描述也看不到管理员.为了完成这项工作,还有什么我应该做的吗?我能够通过将代码放在ViewModel中来解决这个问题,但是想知道为什么这不起作用(或者可能不应该).