I am building windows phone 8 Html 5 application, since my computer does not have capability to show emulator I am testing on real device.
My code is like below, when I launch my application, I do not see anything about banner, however I cannot tap on the place where ad is coming (For example I cannot click top header of browser because I know banner is there but totally transparent - not visible)
Is there any idea why it is happening?
<Grid x:Name="LayoutRoot" Background="Transparent">
<phone:WebBrowser x:Name="Browser"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Loaded="Browser_Loaded"
NavigationFailed="Browser_NavigationFailed" />
<UI:AdControl ApplicationId="test_client"
AdUnitId="Image480_80" Margin="0,0,10,600" />
</Grid>
It could be that it's working but there wasn't an ad available when you ran it. Add an event handler to the ErrorOccurred event and see if it gets hit. If ErrorOccurred get's hit, you should be able to look at what the error was. Most likely it will just be that there isn't an ad to show.
It's happened to me a few times, but it was just the fact that there's more ad's being requested to be shown than there are ad's to fill the spaces.
Related
I have a Windows Phone 8.1 app (WinRT) where I have a gridview where I can reorder images, and it's working fine.
The same app, on a phone running Windows 10 cannot reorder items.
The reorder mode is set correctly and the images are kind of floating just like on WP8.1 but when I drop items, nothing changes.
Is this a known bug or is this a workaround to make it work ?
My code is as follow :
<GridView x:Name="GridView"
VerticalAlignment="Top"
Margin="-3"
IsSwipeEnabled="True"
AllowDrop="True"
CanReorderItems="True"
ItemsSource="{Binding ImagesReordered}">
and in code
private void EnableReorderMode()
{
this.IsReordering = true;
this.GridView.ReorderMode = ListViewReorderMode.Enabled;
}
EDIT
Just tried with simpler code (only xaml) :
<GridView AllowDrop="true"
CanReorderItems="true"
ReorderMode="Enabled">
<GridViewItem>
<Rectangle Width="80"
Height="80"
Fill="Red"
Margin="4" />
</GridViewItem>
<GridViewItem>
<Rectangle Width="80"
Height="80"
Fill="Yellow"
Margin="4" />
</GridViewItem>
<GridViewItem>
<Rectangle Width="80"
Height="80"
Fill="Green"
Margin="4" />
</GridViewItem>
</GridView>
On a WP 8.1 app the reorder is working on a WP 8.1 but not on Windows 10 mobile.
On a W10 uwp, the reorder is working fine on windows 10.
This should be the same issue we are tracking on MSDN forum https://social.msdn.microsoft.com/Forums/en-US/49a84f9f-69d7-4304-9cb7-ac44fd570252/w81-listview-canreorderitems-functionality-broken-in-windows-10-build-1511?forum=wpdevelop
Please keep monitoring that case, and we will update there about any progress. The same issue happens to ListView and GridView. By checking the internal status, the proposed fix will address both controls' issue from their base class. But I still cannot say when/how the fix will be available. If it is very urgent for you with big impact, please follow the instruction introduced by Prashant in that MSDN thread to contact MS support.
To workaround this issue, you need to handle the drag and drop by yourselves if above information cannot help you.
I'm trying to insert ad in a Windows Phone 8 app using Visual Studio 2013 Ultimate.
I inserted this code in MainPage.xaml :
xmlns:UI="using:Microsoft.Advertising.WinRT.UI"
And my Grid tag:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<UI:AdControl
ApplicationId="----------------------"
AdUnitId="------"
HorizontalAlignment="Left"
Height="500"
Margin="0,0,0,0"
VerticalAlignment="Top"
Width="200"/>
</Grid>
Why do I get this error?
AdControl not exist in namespace "using: Microsoft.Advertising.WinRT.UI"
Errore2 type 'UI: AdControl' not found. Check for missing a reference to an assembly and all assembly to which you refer have been compiled
Right click on Reference in your Solution Explorer window and select Add Reference.
WINDOWS RT (UNIVERSAL APPS)
Then move on Windows Phone 8.1 Tab and select 'Extensions'. You should find Microsoft Advertising SDK for Windows Phone 8.1 XAML. Select it and click ok, then rebuild (F6)
WINDOWS PHONE SILVERLIGHT
Move on Assemblies tab, then click on Extensions and add these 2 references:
Microsoft.Advertising.Mobile
Microsoft.Advertising.Mobile.UI
Then you have to add in the XAML page this namespace:
xmlns:adv="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
and finally add the advertising control to your page:
<adv:AdControl ApplicationId="YOUR_APPLICATION_ID" AdUnitId="YOUR_AD_UNIT_ID"
Width="480" Height="80"/>
If you're not able to find references, it's beacuse you didn't install the SDK on your computer. Go here, download the right version according to your needs and install it, then repeat the steps.
Let me know if it works!
I have two images, one for windows phone and second for windows project. and I want these images on every page of their respective platform.
What currently I am doing is setting background from app.cs in if windows phone and if windows app code snippets.
I want any xaml method if any for this.
Set the background of each page to a common resource and then set that resource to your image. By default the page's background will be set to
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
You can set the ApplicationPageBackgroundThemeBrush to an ImageBrush in your app.xaml's Resources, but since you want different images for Windows and for Windows Phone add another level of indirection. Create a ResourceDictionary of the same name in both projects and then merge that dictionary into Application.Resources.
In app.xaml:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="PlatformDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Then set the actual brush in PlatformDictionary.xaml files in the Windows and Windows Phone projects. Generally you'll fall back to defaults in HighContrast modes, but if you have important information in the image you can provide a high contrast version of the image as PhonePageBackground.contrast-high.png using the contrast resource qualifiers:
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Name="Default">
<ImageBrush x:Key="ApplicationPageBackgroundThemeBrush" ImageSource="Assets/PhonePageBackground.png"/>
</ResourceDictionary>
<ResourceDictionary x:Name="HighContrast">
<SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="{ThemeResource PhoneBackgroundColor}"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
The Windows version will be the same except for your Windows page background image in the default theme and SystemColorWindowColor in the HighContrast theme.
I need to create a reorderable ListView in a Windows Phone 8.1 app created using WinRT.
The XAML is the following (it binds to an ObservableDictionary in the codebehind):
<Grid Margin="24">
<ListView x:Name="MainListView" CanDragItems="True" CanReorderItems="True" AllowDrop="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<ListView.ItemTemplate>
<DataTemplate>
<Border Padding="24" Margin="16" Background="CadetBlue">
<TextBlock Text="{Binding}" />
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
The ListView does nothing when I try to reorder the items (it looks like the "reordering mode" is not activated).
When I run this sample in Windows 8.1 (the XAML is shared) it works as expected. According to the documentation Windows Phone 8.1 should be supported.
Is this functionality supported on the phone (and the documentation wrong) or do I need to do something special for the phone?
For WP you need to set ListViewBase.ReorderMode
This is what works for me - no idea which properties are really necessary; ReorderMode is set in code behind:
<ListView x:Name="fooListView"
ItemsSource="{Binding barlist, Mode=OneWay}"
SelectionMode="None"
AllowDrop="True" CanDragItems="True" IsSwipeEnabled="True" />
The ListViewBase.Reorder property is available only for Windows Phone, so if you have the XAML in a Shared part of a universal app, you need to set it using conditional compile like so:
#if WINDOWS_PHONE_APP
MainListView.ReorderMode = ListViewReorderMode.Enabled;
#endif
It appears that the property CanReorderItems is not supported on Windows Phone 8.1.
(I tried a simple example, and it does not work, and I could not find any combination that made it work as it does on Windows 8.1.)
I just upgraded my app to Windows 8.1, but now pages that I am loading into the WebView are no longer interactive. I can't press any buttons or fill out any HTML form fields. My WebView looks like this
<WebView x:Name="browser" ScrollViewer.ZoomMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"></WebView>
I just created a new Windows Store app for Windows 8.1 based on the Blank App (XAML) template only putting the following line inside the Grid of MainPage.xaml:
<WebView x:Name="browser" ScrollViewer.ZoomMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" Source="http://www.quackit.com/html/codes/html_form_code.cfm" />
The HTML form controls behave as expected. Does this work for you? Do you have anything else on your page that could prevent interaction with HTML controls?
Maybe you have other (transparent) controls over the WebView. There's a change in z-ordering in Windows 8.1: in Windows 8 WebView was always rendered on top of other controls, now it can be rendered under other controls.
I just put the WebView with an Rectangle in a Grid and it seems that all the inputs are captured by the Rectangle:
<Grid>
<WebView Name="ContentWebView" ScrollViewer.ZoomMode="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollMode="Disabled"
DefaultBackgroundColor="Transparent" Height="Auto" MinHeight="600" />
<Rectangle Fill="Transparent"></Rectangle>
</Grid>
U should navigate webview or set source as explained above. Blank webview does not show anything
browser.navigate("http://example.com//");