XAML条件编译 [英] XAML Conditional Compilation

查看:211
本文介绍了XAML条件编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的xaml文件中有一个简单的方法来使用我的c#代码使用的相同条件编译符号?

Is there an easy way to use the same conditional compilation symbol that I'm using for my c# code, in my xaml files?

推荐答案

有一些支持 XAML中的条件编译。它不一样的在C#,代码,虽然。诀窍是使用 AlternateContent 要求标记 Ignorable 。通过这样做,您可以根据条件实际使用部分xaml无法使用,然后打开或关闭。

There is some support for conditional compilation in XAML. It's not the same as in C#, code, though. The trick is to use AlternateContent with Requires against something flagged Ignorable. By doing this, you can actually have portions of your xaml unavailable based on conditions, and turn on or off.

这篇关于XAML条件编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆