I'm using C# and Windows Phone 8.1 (as Universal). I have a WebView using this code:
<WebView x:Name="webView"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ScrollViewer.ZoomMode="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
I load an HTML string or URI but when I scroll or tap on WebView it terminates my Application.
How do I resolve this?
Related
Hi guys i'm building a Universal Windows App for windows 10 IOT.
So, I'didn't found a method to get a label value from resources file, directly from WPF.
There is a method like this:
<Button Content="{x:StaticResources local:mylabel" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="btnUpdate" Margin="0,200,0,0" MinWidth="300" Command="{Binding add}" />
on the "normal" WPF it's easy, but on universal windows app I didn't
found a solution.
The resources file within on Resources folder in my solution, while the page it's in view folder.
Thanks
In UWP you can use x:Uid directive to associate a control with a string resource identifier:
<Button x:Uid="mylabel" Name="btnUpdate" .... Command="{Binding add}" />
Please refer to MSDN for more information: https://learn.microsoft.com/en-us/windows/uwp/app-resources/localize-strings-ui-manifest
I am developing an application for Android, iOS and Visual Studio using Xamarin
I added the following lines in xaml to use images:
<Image Source="header.png" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" />
<Button x:Name="Object_Detection" Image="header.png" />
The first is for displaying an image in the header and the second is for displaying a button icon. They link for the same image "header.png"
I put the image under:
- Mobile.Droid\Resources\drawable
- Mobile.iOS\Resources
-Mobile.Windows\Assets
But the image is not shown at all in the Windows 8.1 app.
the image size is 690*79.
how to resolve the problem?
You have to place images in the root Project directory for Windows Phone 8, Windows Phone 8.1 and UWP applications.
This guide will help you
http://developer.xamarin.com/guides/xamarin-forms/working-with/images
Try something like this :
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:Key="ImageHeaders"
x:TypeArguments="ImageSource"
iOS="header.png"
Android="header.png"
WinPhone="Assets/header.png" />
</ResourceDictionary>
</ContentPage.Resources>
<Image Source="{StaticResource ImageHeaders}" />
OR
<Image.Source>
<OnPlatform x:TypeArguments="ImageSource">
<OnPlatform.iOS><FileImageSource File="header.png"/></OnPlatform.iOS>
<OnPlatform.Android><FileImageSource File="header.png"/></OnPlatform.Android>
<OnPlatform.WinPhone><FileImageSource File="Assets/header.png"/></OnPlatform.WinPhone>
</OnPlatform>
</Image.Source>
Not tested, but it seems to work well.
Thanks for all your posts,
the solution was to add the image resource to the windows sub-project directly under the root.
The addition should be made using visual studio so that the image will be taken in consideration by the compiler.
I 'm developping a windows phone 8.1 application and I would like to make a view with the panorama control but Its impossible to find the control
I have the Pivot control but not the panorama, is the panorama control is available on windows phone 8.1 ?
I have find nothing on it on the Internet so far :/
Thanks for the help :)
The Panorama control has been renamed Hub because it’s now available on both Windows Phone and on Windows. So, you would do something like:
<Hub Header="My header">
<HubSection Header="My sub header">
<DataTemplate>
<Grid />
</DataTemplate>
</HubSection>
<HubSection Header="My sub header 2">
<DataTemplate>
<Grid />
</DataTemplate>
</HubSection>
There are some changes in the API, as you will use HubSection instead of a PanoramaItem, and you must have a DataTemplate inside a HubSection, so be sure to check the following reference:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.hub.aspx
There are some nuances as a slightly different and odd behaviour when you have only 2 HubSections, as noted here: Windows Phone 8.1 app with 2 hub sections, but that may or may not be an issue for you. Some guidelines and implementation examples can be found here:
https://msdn.microsoft.com/en-us/library/windows/apps/dn449149.aspx
I am trying to change the context of a button inside a DataTemplate, but in my code-behind I can't acses it. What am I doing wrong?
Here is the XAML I am using:
<Grid>
<Hub>
<HubSection>
<DataTemplate>
<Grid>
<Button x:Name="THEbutten" Content="Button" HorizontalAlignment="Left" Margin="186,230,0,0" VerticalAlignment="Top"/>
</Grid>
</DataTemplate>
</HubSection>
</Hub>
</Grid>
Your Button is inside a DataTemplate, and therefore it is in a different context than the page and not accessible from it's codebehind.
Consider the following options:
Modify your Buttons Properties using Data Binding.
Create a UserControl for your HubSections Content.
Sadly, the Hub Control is fairly hard to understand and use for beginners, because of this DataTemplate.
Here are some tutorials:
Mikaelkoskinen - Getting started
DotNetCurry - The Windows 8.1 Hub Control
There are also several questions around here on that topic:
How to access controls within hubsections
MediaElement Windows Phone 8.1 does not play links to resources, for example http://kgot-fm.akacast.akamaistream.net/7/449/31707/v1/auth.akacast.akamaistream.net/kgot-fm, but plays links. mp3. Windows 8 running all references. What's the problem? and how to fix it? the same code.
//only works in windows 8.1
<MediaElement x:Name="MediaElement"
Source="http://kgot-fm.akacast.akamaistream.net/7/449/31707/v1/auth.akacast.akamaistream.net/kgot-fm"
AutoPlay="True" Margin="199,320,114,252" Width="100" Height="100"/>
//works in windows 8, and in windows phone 8.1
<MediaElement x:Name="MediaElement"
Source="http://radio02-cn03.akadostream.ru:8114/businessfm96.mp3"
AutoPlay="True" Margin="199,320,114,252" Width="100" Height="100"/>
If you subscribe to MediaElement.MediaFailed:
MediaElement.MediaFailed += MediaElement_MediaFailed;
then you will see that using the first link you get:
MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT - 0xC00D2EE0
which means (HRESULT) that:
0xC00D2EE0 NS_E_UNKNOWN_PROTOCOL
The specified protocol is not supported.
The list of supported audio and video formats you will find here.
from the c# set the string as uri
MediaElement.Source = new Uri("http://kgot-fm.akacast.akamaistream.net/7/449/31707/v1/auth.akacast.akamaistream.net/kgot-fm");