Set whole background image/colour in WP7 - silverlight

I can't seem work out (even though I have seen other apps) how to set the whole background of a WP7 page to a image or colour, like in Panorama for example.
If i set
Grid x:Name="LayoutRoot" Background="#FF0079C1"
Or
<Grid.Background>
<ImageBrush ImageSource="/images/highwaysBack.jpg" Stretch="None" />
</Grid.Background>
it still leaves the top info section either black or white depending on the phone setting.
Many thanks.

That's most likely the System Tray. You can hide that by setting shell:SystemTray.IsVisible="False" on your page.

Make a note that hiding the system tray isn't something you always want to do, as you're hiding info like the battery life. Only do it because you app absolutely has to, like a video game. If it's just a simpler app there shouldn't be a real neeed to hide it.

Related

WPF Inkcanvas cann't be seen after saving

I can write well. But WPF Inkcanvas can not be seen after saving in tablet.
but if i use another computer (not tablet), can write and see well.
Your question is not clear. Based on my understanding, I hope that is because the size of the tablet screen which is smaller than the desktop that makes the strokes to get hidden inside the area that was not visible on the tablet, However, the area is visible in Desktop.
Have the InkCanvas inside the Viewbox. I hope that will fix your issue.
<Grid>
<Viewbox Stretch="Fill">
<InkCanvas />
</Viewbox>
</Grid>

Can't get Silverlight Media Framework SMFPlayer to show film full screen or correct aspect ratio

I am using the latest version of the Silverlight Media Framework on Windows Phone 8. I have got both standard MP4's and DRM encrypted MWV media to play successfully.
However, neither will play to the full extent of the screen.
The standard MP4's play with the correct aspect ratio, but don't fill the available area. Some film do, so I imagine that some have a lower resolution than the phone, so play smaller. It would be good to get even lower resolution films to play to full screen.
The DRM films fill the screen vertically, but are 'squished' horizontally (in a 4:3 aspect ratio). These are supposed to be wide screen movies (!
I have tried a few things, such as setting the play item to the height and width of the player
item.VideoHeight = player.ActualHeight;
item.VideoWidth = player.ActualWidth;
item.VideoStretchMode = Stretch.Uniform;
This didn't work. Nor did setting the following in the player xaml!
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
I am using the simplest implementation in XAML at the moment.
<core:SMFPlayer
Name="player"
IsEnabled="True"
Grid.Row="0"
CaptionsVisibility="Disabled"
VolumeLevel="50"
Visibility="{Binding DisplayError, ConverterParameter=true, Converter={StaticResource BoolToVisibilityConverter}}"
/>
Can someone help? I need to be able to force all media playback to play as full screen as possible while maintaining aspect ratio and not clipping.
Are there any properties of the SMF I can set to get films to play as large as possible and preserve aspect ratios?
You want your containers, not just your video, to have Stretch="Uniform" set. That is, either Grid, SMFPlayer, etc... I'm not sure exactly which element will need to have that, it depends on your XAML.
This should do what you want: fill as much as possible the screen, while retaining aspect ratio, without cropping. There is another mode if you want to 'zoom', ie crop so screen is always filled: Stretch="UniformToFill".

Full Screen Image with Transparent System Tray

The Search Page in Windows Phone 7 (Bing search) is lovely; uses the entire area for a nice piccy. The system bar is transparent but the icons are still there.
I can't seem to reproduce this effect.
If I set an image on the LayoutRoot it only goes up to the bottom of the system tray.
If I hide the system tray, it is always hidden.
If I make the system tray background transparent, I can see the dark/light theme colour (black or white) through it, which looks terrible with the image background in LayoutRoot.
If I try and set the Background of phone:PhoneApplicationPage nothing happens. I tried styling this but couldn't make it work.
I'd be grateful if a Windows Phone 7 guru could help me out here.
Try this:
Set the d:DesignHeight="800" and Background="Transparent" for the <phone:PhoneApplicationPage >
Then for the ApplicationBar,
Set Mode="Minimized" BackgroundColor="Transparent"
Almost similar to the one in Bing Search page, but still a little area at the bottom I couldn't cover.

MediaElement audio/video out of sync when inside a ViewBox

I'm using Viewbox controls to proportionally size content in my app at a certain display size. I don't know what the display size of the target computer will be, but I need the app's layout, fonts, graphics, etc to look the same on the target computer as on my machine. Viewbox has worked great for me in the past to accomplish this.
However, when I include a MediaElement (to play a WMV) inside the Viewbox, the media's audio and video get out of sync. The video lags behind, then speeds up, then lags behind, then speeds up, etc.
My actual layout looks something like this:
<Grid>
<Viewbox>
<Grid Width="888" Height="500"> <!-- 16:9 screen size -->
<!-- row definitions -->
<Viewbox Grid.Row="1">
<Grid>
<custom:TransitionFrame />
<!-- TransitionFrame inherits from Frame -->
<!-- TransitionFrame holds a Page that
looks like this:
<Grid>
<MediaElement />
</Grid>
-->
</Grid>
</Viewbox>
</Grid>
</Viewbox>
</Grid>
Any ideas on why this would impact the video? Any ideas on how to resolve it?
Ugh. This has caused me sooooooo much issues. Its really depends on the machine. I have a pretty solid development machine and have never seen any issues. Then I ran the application on another normal machine and it was choppy as hell. I had to play with the following settings:
Switching monitors
Switching screen refresh rates
Switching resolution
Switching graphic cards.
Then when I got the out-of sync issues to < 500ms I created another layout and put in an option saying low graphics and it played fine. I made the other layout very basic with no more than one ViewBox.
I recommend staying away from Viewboxes with MediaElements

Silverlight 4 ContextMenu and ScaleTransform

The ContextMenu provided by the Silverlight 4 Toolkit worked great until I implemented a
<RenderTransform> tag in my XAML in order to have the Silverlight app scale to fit the entire browser window (following this little tutorial)
When all worked great, before the tutorial, my XAML looked like:
<UserControl>
<Grid>
<!-- Rest of app here... -->
</Grid>
</UserControl>
Now, my app looks like:
<UserControl>
<Canvas>
<Canvas.RenderTransform>
<ScaleTransform [vars]></ScaleTransform>
</Canvas.RenderTransform>
<Grid>
<!-- Rest of app here... -->
</Grid>
</Canvas>
</UserControl>
The scaling works perfectly, but now when I right click, the ContextMenu doesn't appear where it should (under the mouse). Instead, it appears at the same x-position as the mouse, but it shows up at the very top of the app. It's also very buggy, I have to keep clicking around to get it to go away, and I can't right click somewhere else to bring it up again, and it doesn't scale along with the rest of the app.
What might be causing this? Is there a correct way to go about fixing this, or should I just apply an offset to the menu to move it to the mouse?
You will need to pass the cursor coordinates through the inverse of your scale transformation to convert the screen point to a point your application understands.

Resources