Windows Phone 8.1 Silverlight 和 XAML [英] Windows Phone 8.1 Silverlight and XAML
问题描述
有什么方法可以将 XAML 控件添加到我的 WP 8.1 Silverlight 应用程序中?我想使用进度环和拨动开关,但似乎 Silverlight 没有它们.我怎样才能添加它们?
Is there any way I can add XAML controls to my WP 8.1 Silverlight app? I'd like to use progress rings and toggle switches but it seems like Silverlight doesn't have them. How can I add them?
顺便说一下,添加使用 Windows.UI.Xaml.Controls"引用不起作用.
Adding a "using Windows.UI.Xaml.Controls" reference doesn't work by the way.
推荐答案
Windows.UI.Xaml.Controls 仅适用于 Windows Phone 8.1 运行时(或更广为人知的通用应用).如果您不喜欢 Silverlight 中已有的控件,微软已经发布了一个扩展的控件工具包,全称为Windows Phone Toolkit".您可以通过右键单击参考"->管理 NuGet 包"-> 搜索工具包"并选择 Microsoft 提供的工具包来使用 NuGet.
Windows.UI.Xaml.Controls is Windows Phone 8.1 Runtime only (or better known as Universal App). If you don't like the controls already in Silverlight, Microsoft has release a extended control kit all "Windows Phone Toolkit". You can get it using NuGet by right clicking the References -> Manage NuGet Packages -> Search "Toolkit" and select the one by Microsoft.
将命名空间添加到您的 XAML 中,您就可以开始了.
Add the namespace to your XAML and you're ready to go.
<phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">
Windows Phone 工具包的 CodePlex 项目页面
工具箱中所有工具包控件的列表
List of All Toolkit Control's in the Toolbox
这篇关于Windows Phone 8.1 Silverlight 和 XAML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!