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.
Related
So I create a new blank universal project, drag in a Textblock, enter "Hello World" as the content and start debug session. But the text doesn't display on the screen. I've tried with both virtual device (simulator) and real phone.
But running as a windows app (on local machine) does shows the text. Also other controls work too, like textbox or an image (on both PC and phone).
Does anyone know what I did wrong? I've just started learning Universal app. Thanks.
I am currently working on an application that was developed using windows phone 8.0 sdk and and i targeted it to work with Wp8.1 SDK. Everything is working fine, apart from the issue with tiles. For some reason, it is taking the WMAAppmanifest settings into consideration instead of the Package.appxmanifest file.
here's my Application tag in the Package.appxmanifest file,
<Applications>
<Application Id="xxxxxxxxxxxxxxxxxx" Executable="AGHost.exe" EntryPoint="/Views/SplashScreen.xaml">
<m3:VisualElements DisplayName="SampleUI" Square150x150Logo="Assets\SquareTile150x150.png" Square44x44Logo="Assets\Logo.png" Description="SyncUI" ForegroundText="light" BackgroundColor="#464646">
<m3:DefaultTile Square71x71Logo="Assets\SquareTile71x71.png">
</m3:DefaultTile>
<m3:SplashScreen Image="Assets\Splashscreen.png" />
</m3:VisualElements>
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="ScheduleSync.TimerTriggerTask">
<BackgroundTasks>
<Task Type="systemEvent" />
<Task Type="timer" />
</BackgroundTasks>
</Extension>
</Extensions>
</Application>
</Applications>
The tile doesn't seem to change irrespective of what i change the image to be.
Am i looking at the right place? Is there some other place where i need to change the tiles ?
I had to change the tile in the WMAppmanifest instead of the Packageappxmanifest.
Here's the sample,
<Tokens>
<PrimaryToken TokenID="Token1" TaskName="_default">
<TemplateType5>
<BackgroundImageURI IsRelative="true" IsResource="false">Images\Cloud_WP8_71x71.png</BackgroundImageURI>
<Count>0</Count>
<Title>Sample Cloud</Title>
</TemplateType5>
</PrimaryToken>
</Tokens>
Double Click on the Package.appxmanifest in the Solution Explorer of your project. It will load up a GUI for updating the App manifest rather than using the xml versions.
In the GUI representation there will be a 'Visual Assets' Tab at the top which will let you set each of the different tiles.
Here is a link to a video of how to use the Package.appmanifest file. It also talks about hwo to set the tiles of the app. http://channel9.msdn.com/Series/Windows-Phone-8-1-Development-for-Absolute-Beginners/Part-8-Working-with-the-package-appxmanifest
I have a WP8 project originated from template "DirectX App (Windows Phone 8.0)". How do I set supported orientation (I want to make it landscape-only)? I have found file named "WMAppManifest.xml" in project folder, but it has no "orientation" option.
for performance reasons, the option of automatic rotation is not available on Windows Phone 8, so we’re stuck with having to manually take care of everything: rotating stuff before we draw them, and processing input values to fit them to the new orientation. There are several things that we need to do in order to support other orientations besides the default Portrait one.
You can find more Reference here Handling Orientation in a Windows Phone 8 game
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//");
Windows Phone 8 :
I have an HTML design to bind in webbrowser control.
In that HTML I need to set the image() dynamically from my windows 8 phone application itself (Eg:MyApp/Images/Done.png).
How to set this Image in my HTML dynamically?
Could any one help me on that?
In terms of Zen, WP8 tried to align Uris as close as possible to Win8 Uris. So whenever you ask yourself "How do WP8 Uris work?" a good starting point would be Win8 and WP7 behaved. For example, you'll see lots of "ms-appx:///" and "ms-appdata:///" all around WP8.
Specfically, In order to access an app's Image resources from a WebBrowser just specify the local file path.For example, start a new WP8 project and in MainPage.xaml add:
<phone:WebBrowser Source="myPage.html" />
And create myPage.html and add:
<html>
<body>
<img src="Assets/AlignmentGrid.png"/>
</body>
</html>
This would render the correct image as part of the WebBrowser. See attached .