XAML 条件编译 [英] XAML Conditional Compilation

查看:42
本文介绍了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 和 Requiresrel="noreferrer">可忽略.通过这样做,您实际上可以根据条件使部分 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天全站免登陆