简体   繁体   English

Windows Phone 8.1 Silverlight和XAML

[英]Windows Phone 8.1 Silverlight and XAML

Is there any way I can add XAML controls to my WP 8.1 Silverlight app? 有什么办法可以将XAML控件添加到我的WP 8.1 Silverlight应用程序中吗? I'd like to use progress rings and toggle switches but it seems like Silverlight doesn't have them. 我想使用进度环和切换开关,但似乎Silverlight没有它们。 How can I add them? 我该如何添加它们?

Adding a "using Windows.UI.Xaml.Controls" reference doesn't work by the way. 添加“使用Windows.UI.Xaml.Controls”引用不起作用。

Windows.UI.Xaml.Controls is Windows Phone 8.1 Runtime only (or better known as Universal App). Windows.UI.Xaml.Controls仅适用于Windows Phone 8.1 Runtime(或更好地称为Universal App)。 If you don't like the controls already in Silverlight, Microsoft has release a extended control kit all "Windows Phone Toolkit". 如果您不喜欢Silverlight中已有的控件,Microsoft已发布了所有“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. 您可以通过右键单击References - > Manage NuGet Packages - > Search“Toolkit”并使用NuGet选择一个来获取它。

工具包

Add the namespace to your XAML and you're ready to go. 将命名空间添加到您的XAML,您就可以开始了。

<phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">

The Windows Phone Toolkit's CodePlex Project Page Windows Phone Toolkit的CodePlex项目页面


List of All Toolkit Control's in the Toolbox 工具箱中的所有工具包控件列表

在此输入图像描述

Unfortunately, at this time you can't mix Silverlight and WinRT controls. 不幸的是,此时你无法混合使用Silverlight和WinRT控件。 And I doubt it will ever be possible, as Microsoft is likely to move towards ditching Silverlight. 我怀疑它是否有可能,因为微软很可能会放弃Silverlight。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM