Can't create flyout in Windows Phone 8.1 Silverlight app - xaml

Adding a flyout seemed like a pretty straightforward task, but I can't seem to even initialize one on my app (which is based on a PivotControl app template for Windows Phone 8.1 Silverlight). When I attempt to do this:
<phone:PhoneApplicationPage.Resources>
<Flyout x:Key="MyFlyout"></Flyout>
</phone:PhoneApplicationPage.Resources>
I immediately get a blue squiggly line below Flyout saying "The name Flyout doesn't exist in the namespace http://schemas.microsoft.com/clients/2007". What gives?

<Flyout> is only available in Windows Phone 8.1 runtime (Silverlight is a no-go). See the MSDN Reference FlyOut.
If you want something similar to a <Flyout> that would work for Silverlight, download and install the Windows Phone Toolkit -- NuGet or get it here : The Windows Phone Toolkit
Using the <toolkit:ContextMenuService.ContextMenu>
<container_ui>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="menu_1" Click="Click_Event"/>
<toolkit:MenuItem Header="menu_2" Command="{Binding CommandBinding}"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</container_ui>

Related

How can I find namespace in xaml?

If you look at SettingsPage.xaml in a project created by TemplateStudio, you will find the following code: It doesn't work if I write the same code on the project I created without TemplateStudio. How can I find namespace Microsoft.UI.Xaml?
I'm working on the WinUI3 project.
<Page xmlns:xaml="using:Microsoft.UI.Xaml">
<RadioButton>
<RadioButton.CommandParameter>
<xaml:ElementTheme>Light</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
</Page>
Refer to the Doc: Download and install the Windows UI Library
In the NuGet Package Manager, select the Browse tab and search for
Microsoft.UI.Xaml or WinUI. Select which Windows UI Library NuGet
Packages you want to use (the Microsoft.UI.Xaml package contains
Fluent controls and features suitable for all apps). Click Install.

WP8.1 String Resource in ResourceDictionary

How do I define a string in a ResourceDictionary in my WP8.1 app?
I already added
xmlns:sys="clr-namespace:System;assembly=mscorlib"
to my ResourceDictionary but Visual Studio 2013 says that "sys:String" wasn't found.
How can I fix that?
The problem is probably becouse you are targetting WP8.1 Runtime app. As method you have described will still be working in WP8.1 Silverlight, in Runtime you can declare build-in types in xaml like this:
<x:String x:Key="myKey">Text</x:String>
More about differences and porting Silverlight app to Runtime you will find here at MSDN.

XAML Designer not loading WinRT Toolkit for windows phone 8.1

I'm trying to use the WinRT Toolkit for wp 8.1 in my project. I installed the package from nuget and have written this snippet in the main grid.The Emulator works just fine. but The XAML Designer is not loading the control, what do I need to do?
<faysal:CascadingTextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="fafdsda"
FontSize="35"
/>
the namespace in the xaml is like below
xmlns:faysal="using:WinRTXamlToolkit.Controls"
WinRT XAML Toolkit doesn't have good support for design view unfortunately. CascadingTextBlock is one of the controls that simply doesn't show up in the designer.
To install WinRT XAML Toolkit - Data Visualization Controls, run the following command in the Package Manager Console
Install-Package WinRTXamlToolkit.Controls.DataVisualization
then xmlns:faysal="using:WinRTXamlToolkit.Controls"

Microsoft.Phone.Tasks namespace is not available

Namespace Microsoft.Phone.Tasks is not available in XAML page code behind file of my Windows Phone application. Please see the screenshot.
In the properties windows of the project I see:
Target: Windows Phone 8.1
Am I missing an assembly reference or something?
Windows Phone 8.1 XAML apps don't have Microsoft.Phone.Tasks namespace to make common UI framework with windows Runtime APIs. Still you can code up a few tasks by using Windows.ApplicationModel namespace. As you havent claried which task you want to use, so here's the link to the whole MSDN article. http://code.msdn.microsoft.com/windowsapps/WindowsPhone-Store-81-vs-25c80c2a
From your Screenshot. I see your project is Windows Phone 8.1, not Windows Phone Silverlight 8.1 . Please see your Solution Explorer, is it Windows Phone 8.1? If so, there are not Microsoft.Phone.Tasks namespace anymore. If you want to choose picture, you should use FileOpenPicker.

Windows phone wrapPanel does not exist error

I have a xaml which has the following code.
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
Now the error says that
The name wrappanel does exist in the namespace clr-namespace:Microsoft.Phone.Controls etc...
Any idea how to fix it.
You need to add the namespace to the root element of the page and you also need to reference it in your project either directly from the disk or by using NuGet:
Install-Package WPToolkit
In your XAML add the following:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Try reinstalling the package, it worked
It's not working because Windows Phone toolkit is only available for
Windows Phone Silverlight Applications.