Windows Phone prevent ScrollViewer "over scrolling" behavior - windows-phone

My form contents are displayed in a Grid inside of a Scrollview on a page.
<phone:PhoneApplicationPage
x:Class="DS.Mobile.Pages.FormAppPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
>
<ScrollViewer >
<Grid x:Name="_canvas" Background="Gainsboro">
</Grid>
</ScrollViewer>
</phone:PhoneApplicationPage>
Normally the content can be viewed without any scrolling action, but windows provides a dramatic over scrolling behavior anyway if you drag across the screen surface. How do you prevent this over scroll behavior?

Related

make a XAML UserControl completely transparent

Could be a user control completely transparent?
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
mc:Ignorable="d"
x:Class="MainWindow.UserControl3"
Width="600" Height="600">
<Grid x:Name="LayoutRoot" Background="Transparent"/>
</UserControl>
if I execute the previous code the result is a black window, not transparent why?
Thanks

Making the image as a background (Send to back)

I would like to have an image in this grid that serves as a background. Any attempt till now at inserting an image control resulted in the image being on top of the buttons while I would like it to be on the back.
<Page
x:Class="ZimmerFrei_v0._1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ZimmerFrei_v0._1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid >
<Button x:Name="btnNearMe"
Content="Near Me"
HorizontalAlignment="Left"
Margin="99,181,0,0" VerticalAlignment="Top"
Height="76"
Width="216"
Click="btnNearMe_Click"/>
<Button x:Name="btnBestOffers"
Content="Button"
HorizontalAlignment="Left"
Margin="99,312,0,0"
VerticalAlignment="Top"
Height="76" Width="216"
Click="Button_Click"/>
<Image />
</Grid>
The simplest thing that you can do here is to give your Grid an Image Brush. Simply head to the Brush section in your properties windows and select the Tile Brush there. To the ImageSource property specify the image you want.
You can also check out this link for more help.
Hope this solves your problem.

transparent background in windows store app

i'm trying to implement windows store application with transparent background.
in my xaml i wrote:
<Page
x:Class="App4.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App4"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Background="Transparent">
but the background is black
Did you try adding Opacity within your Grid?
<Grid>
<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.5"/>
</Grid.Background>
</Grid>
Reference: How do you override the opacity of a parent control in WPF?

how to set the scroll position on top of silverlight Page

I am Using silverlight4 I have developed one page when I navigate to this page from Other Silverlight Page the Position is at the bottom of the page .I need to set the Focus on top of the silverlight Page.I am not using ScrollViewer on my Page.
Open MainPage.xaml file and replace the code with the following.
<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="ScrollViewerControl.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<ScrollViewer Height="300" Width="300" Name="scrollViewer1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto">
<ScrollViewer.Content>
<StackPanel>
' Content Here
</StackPanel>
</ScrollViewer.Content>
</ScrollViewer>
</Grid>
</UserControl>
set the ScollViewer offset to zero like
scrollViewer1.ScrollToVerticalOffset(0);
then your vertical scroll will always be on Top.

How to make a 100% input dialog using XAML in WinRT

I want to create a simple input dialog and I'm having a hard time getting it to stretch to 100% of the screen width (I can manually set width which is not what I want to do). I've tried the horizontal stretch, I've tried setting a left and right margin (hoping it would anchor the ends to the margin), I've tried specifying RowDefintiions in the grid with "*" Width. I can see in the XAML editor that the popup looks to be 100% of the screen width, but the Grid is not.
Take the below as a simple example.. I want the popup and/or the grid to span 100% width on the screen. Is there a straightforward way to accomplish this?
<Page
x:Class="TimeCalculator.BlankPage1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TimeCalculator"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Popup x:Name="pop" IsOpen="True" Margin="0,0,0,0">
<Grid x:Name="popGrid" Background="Green" HorizontalAlignment="Stretch">
<TextBlock Text="This is the popup where I will ask for input" HorizontalAlignment="Stretch"></TextBlock>
</Grid>
</Popup>
</Grid>
try
popGrid.Width = Window.Current.Bounds.Width;