问题
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?
Adding a "using Windows.UI.Xaml.Controls" reference doesn't work by the way.
回答1:
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.
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">
The Windows Phone Toolkit's CodePlex Project Page
List of All Toolkit Control's in the Toolbox
回答2:
Unfortunately, at this time you can't mix Silverlight and WinRT controls. And I doubt it will ever be possible, as Microsoft is likely to move towards ditching Silverlight.
来源:https://stackoverflow.com/questions/25703114/windows-phone-8-1-silverlight-and-xaml