windows phone 8 scrollviewer hides my button - windows-phone-7

I have written a code to show some input boxes and a connect button. But when I enter value to the input box it hides my connect button, I try to scroll it bounces back?
What could be the source of this issue?
<ScrollViewer>
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<StackPanel Grid.Row="0">
<TextBlock Text="" ></TextBlock>
<TextBlock Text="{Binding Path=LocalizedResources.LoginPromptSignInText, Source={StaticResource LocalizedStrings}}" FontSize="30"></TextBlock>
<TextBlock Text="" ></TextBlock>
<TextBlock Text="{Binding Path=LocalizedResources.UsernameText, Source={StaticResource LocalizedStrings}}" ></TextBlock>
<TextBox x:Name="TextBlockUserName" ></TextBox>
<TextBlock Text="{Binding Path=LocalizedResources.PasswordText, Source={StaticResource LocalizedStrings}}" ></TextBlock>
<StackPanel x:Name="PasswordPanel"/>
<CheckBox x:Name="CheckBoxShowPassword" Click="ShowPassword" Content="{Binding Path=LocalizedResources.LoginPromptShowPasswordText, Source={StaticResource LocalizedStrings}}"></CheckBox>
<TextBlock Text="{Binding Path=LocalizedResources.LoginPromptDomainText, Source={StaticResource LocalizedStrings}}"></TextBlock>
<TextBox x:Name="tbDomain" ></TextBox>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button x:Name="ButtonExit" Content="{Binding Path=LocalizedResources.LoginPromptExitButtonText, Source={StaticResource LocalizedStrings}}" Grid.Row="2" Grid.Column="0" ></Button>
<Button x:Name="ButtonConnect" Content="{Binding Path=LocalizedResources.LoginPromptConnectButtonText, Source={StaticResource LocalizedStrings}}" Grid.Row="2" Grid.Column="1" ></Button>
</Grid>
</StackPanel>
</Grid>
</ScrollViewer>

You could use a ListBox instead of a scroll viewer, also you could try adjusting the Height property of the ScrollViewer.

I would suggest using the ApplicationBar for your buttons. The keyboard shows above the ApplicationBar so the buttons will always be visible.
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<ScrollViewer>
<StackPanel>
<TextBlock Text="" ></TextBlock>
<TextBlock Text="Sign In" FontSize="30"/>
<TextBlock Text="" ></TextBlock>
<TextBlock Text="Username" />
<TextBox x:Name="TextBlockUserName" />
<TextBlock Text="Password" TextTrimming="WordEllipsis" />
<TextBox x:Name="TextBlockPassword" />
<StackPanel x:Name="PasswordPanel"/>
<CheckBox x:Name="CheckBoxShowPassword" Content="ShowPassword"></CheckBox>
<TextBlock Text="Domain"/>
<TextBox x:Name="tbDomain"/>
</StackPanel>
</ScrollViewer>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar>
<shell:ApplicationBarIconButton Text="connect" IconUri="Assets\done.png" Click="OnConnectButtonClick"/>
<shell:ApplicationBarIconButton Text="cancel" IconUri="Assets\cancel.png" Click="OnCancelButtonClick"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

Related

How to Refresh Longlist Selector?

This is my xaml code
<Grid>
<phone:LongListSelector Name="iList" ItemsSource="{Binding}" Grid.Row="1">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Height="60">
<Grid Height="50">
<TextBlock
Grid.Column="0"
TextWrapping="NoWrap"
Text="{Binding Mail}"
Foreground="Black"
FontSize="25"
Margin="0,0,43,10"/>
<Button Visibility="{Binding BtnVisible}" Margin="411,-16,-21,2" BorderBrush="Transparent" Style="{StaticResource ButtonStyle1}">
<Button.Background>
<ImageBrush Stretch="Uniform" ImageSource="/Assets/Icons/InvitePlusIcon.png"/>
</Button.Background>
</Button>
<CheckBox Content="CheckBox"
IsChecked="{Binding IsChecked,Mode=TwoWay}"
Visibility="{Binding CBVisible}"
Background="SkyBlue"
HorizontalAlignment="Left"
Margin="400,-13,0,-4"
VerticalAlignment="Top" Height="67" Width="53"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="0 0 0 1" HorizontalAlignment="Left" Width="456" />
</Grid>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
[1] When I click Edit application bar button. I need page refresh and my checkbox visible is true and button visible is false
[2]How to refresh the longlist selector?
[3]how to change dynamic control display?
[4]check my xaml code. Is this correct or not?
[5]anyone hellp me?

How to wrap ListPicker SelectedItem in windows phone 8

I am using ListPicker from windows phone toolkit. My options are pretty lengthy so my ItemTemplate is,
<DataTemplate>
<TextBlock TextWrapping="Wrap"/>
</DataTemplate>
Now, when I select a lengthy option(say three lines) in Expansion Mode (less then 5 options) it is working good as expected, but when I Use FullMode(more than 5 items) it is not wrapped in the ListPicker.
To be more clear, It is wrapped as expected in the FullModePage but it is not within the control.
<toolkit:ListPicker Margin="0" MinHeight="70" toolkit:TiltEffect.SuppressTilt="True" Template="{StaticResource ListPickerControlCustomTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Top" FontFamily="{StaticResource RegularFont}"
SelectionChanged="SharedAppsCategoryListPicker_OnSelectionChanged" Name="SharedAppsCategoryListPicker"
LayoutUpdated="SharedAppsCategoryListPicker_OnLayoutUpdated" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,20,0">
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="20,15,120,15" FontSize="20" Text="{Binding groupname}" Foreground="{StaticResource ListPickerForegroundColor}"></TextBlock>
<Rectangle Margin="20,10,0,-11" Height="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Stroke="{StaticResource ListPickerDividerColor}" StrokeThickness="0.5" />
</Grid>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Grid Margin="0,0,20,0">
<TextBlock MaxWidth="250" Width="250" TextWrapping="Wrap" FontSize="20" Margin="0,0,120,0" VerticalAlignment="Center" Text="{Binding groupname}" Foreground="{StaticResource ListPickerForegroundColor}" FontFamily="{StaticResource RegularFont}"></TextBlock>
</Grid>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
you would be needed to give width for the Textblock after then Text Would be Wrapped if content is larger than the width of the Textblock.
try this :
<DataTemplate>
<TextBlock TextWrapping="Wrap" width=200/>
</DataTemplate>
Edit:
I have Implemeted it this way
XAML:
<toolkit:ListPicker Margin="0" MinHeight="70" toolkit:TiltEffect.SuppressTilt="True" HorizontalAlignment="Stretch" VerticalAlignment="Top" Name="SharedAppsCategoryListPicker" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,20,0">
<TextBlock Width="300" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="20,15,120,15" FontSize="20" Text="{Binding}" ></TextBlock>
</Grid>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Grid Margin="0,0,20,0">
<TextBlock Width="400" TextWrapping="Wrap" FontSize="20" Margin="0,0,0,0" VerticalAlignment="Center" Text="{Binding}" ></TextBlock>
</Grid>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
Images of O/P:

Windows Phone: how to disable touch scrolling in ScrollViewer (Listbox)?

i have a scrollviewer with a listbox inside: i need to disable the vertical scroll by touch, how can i?
In other words, the user can't scroll with the touch (i have put buttons, but this is another story).
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" x:Name="imagesScrollview" Width="480" Height="595" Margin="0,112,0,63">
<ScrollViewer.RenderTransform>
<CompositeTransform/>
</ScrollViewer.RenderTransform>
<ListBox Name="listavideo" Height="595" Width="480">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Width="470" Height="146" Background="White" BorderBrush="#346699" Click="apri_video" Name="{Binding Mylink}" Margin="5,0,5,0" Padding="5">
<Button.Content>
<StackPanel Orientation="Horizontal" Width="470">
<Image Source="{Binding Thumbnail}" Width="160" HorizontalAlignment="Left" VerticalAlignment="Top" />
<StackPanel Orientation="vertical" Width="285" Margin="0,0,0,0" Height="146">
<StackPanel Orientation="Horizontal" Width="275" Margin="0,0,10,0">
<TextBlock Width="275" FontSize="18" Text="{Binding Title}" Foreground="#34638f" TextWrapping="Wrap" />
</StackPanel>
<StackPanel Orientation="Horizontal" Width="275" Margin="0,0,10,0">
<TextBlock Width="275" FontSize="14" Text="{Binding Description}" Foreground="#51504e" TextWrapping="Wrap" />
</StackPanel>
</StackPanel>
</StackPanel>
</Button.Content>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
Thanks.
<ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" Name="listavideo" Height="595" Width="480" >
<ListBox.ItemTemplate>
...

Getting control from backend in wp7

I am binding a Pivot from backend.
The xaml for my Pivot is:
<controls:Pivot Name="MainPivot" Visibility="Collapsed">
<controls:Pivot.Background>
<ImageBrush ImageSource="Images/ItemBrowse.png"></ImageBrush>
</controls:Pivot.Background>
<controls:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock FontSize="38" Text="{Binding title}" Foreground="White"/>
</DataTemplate>
</controls:Pivot.HeaderTemplate>
<controls:Pivot.ItemTemplate>
<DataTemplate>
<ScrollViewer Name="scroll" Margin="-12" Background="LightGray" VerticalScrollBarVisibility="Auto">
<StackPanel>
<controls:PivotItem Name="pvtItemPrice" >
<StackPanel Orientation="Vertical">
<TextBlock Text="Price" Foreground="Black" FontWeight="Bold" FontSize="28" />
<TextBlock Text="{Binding price}" FontSize="22" Foreground="DarkCyan"/>
</StackPanel>
</controls:PivotItem>
<Border BorderThickness="2" BorderBrush="White" Height="3" Width="470"/>
<controls:PivotItem Name="pvtItemDescription" >
<StackPanel Orientation="Vertical">
<TextBlock Text="Description" Foreground="Black" FontWeight="Bold" FontSize="28" />
<TextBlock Text="{Binding description}" Foreground="Gray" FontSize="22" Width="460" TextWrapping="Wrap"/>
</StackPanel>
</controls:PivotItem>
<Border BorderThickness="2" BorderBrush="White" Height="3" Width="470"/>
<controls:PivotItem Name="pvtItemLocation" >
<StackPanel Orientation="Vertical">
<TextBlock Text="Location:" Foreground="Black" Padding="5" FontWeight="Bold" FontSize="28" />
<Grid >
<StackPanel>
<TextBlock Text="{Binding location}" FontSize="22" Foreground="Brown" Width="460" TextWrapping="Wrap" />
<Button BorderBrush="Transparent" Foreground="Yellow" Name="btnShowMap" Width="370" Content="View in Map" Click="btnShowMap_Click" Height="100">
<Button.Background>
<ImageBrush ImageSource="Images/ImgBtns.png" />
</Button.Background>
</Button>
</StackPanel>
</Grid>
</StackPanel>
</controls:PivotItem>
</StackPanel>
</ScrollViewer>
</DataTemplate>
</controls:Pivot.ItemTemplate>
</controls:Pivot>
But I have to show or hide the btnShowMap according to the user value. But I cannot get the control from backend. Is there anyway I can get the solution for this.
If you have the markup above within a page, you should find that Visual Studio will have generated a btnShowMap field for you. Simply navigate to the code-behind for this file and you will find it.

How Can i set List Box with in A pivot

my problem is how can i set listbox which has itemtemplate ,and it also itemteplate of pivot
.i don't have any idea to doing this but it is a need of my project .one another is how to set pivot header . i m trying to do something like that
<controls:Pivot Height="779" Name="m" >
<controls:Pivot.Background>
<ImageBrush ImageSource="/WindowsPhoneApplication7;component
/Images/S.jpeg" />
</controls:Pivot.Background>
<!--<controls:PivotItem Name="all" >-->
<controls:Pivot.ItemTemplate>
<DataTemplate>
<ListBox Height="450" HorizontalAlignment="Stretch" Margin="8,6,0,0" Name="listBox1" VerticalAlignment="Stretch" Background="#00537393" Width="445" >
<ListBox.ItemTemplate >
<DataTemplate >
<Border BorderBrush="Black" CornerRadius="8" BorderThickness="1" HorizontalAlignment="Stretch" Name="border">
<Grid HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="0*" />
<RowDefinition Height="100*" />
</Grid.RowDefinitions>
<Image Height="78" HorizontalAlignment="Left" Margin="13,12,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="92" Grid.Row="1" Source="{Binding ImageSource}" />
<TextBlock Foreground="White" Height="80" HorizontalAlignment="Left" Margin="111,12,0,0" Name="textBlock1" Text="{Binding Title}" VerticalAlignment="Top" Width="280" TextWrapping="Wrap" Grid.Row="1" />
<Image Grid.Row="1" Height="75" HorizontalAlignment="Left" Margin="380,12,0,0" Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="73" Source="/WindowsPhoneApplication7;component/Images/appbar.transport.play.rest.png" />
<TextBlock Foreground="White" Grid.Row="1" Height="20" HorizontalAlignment="Left" Margin="111,88,0,0" Name="textBlock2" Text="{Binding date}" VerticalAlignment="Top" Width="190" FontSize="11" />
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</controls:Pivot.ItemTemplate>
<controls:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="hiii" TextWrapping="Wrap" FontSize="0" Foreground="White" />
</DataTemplate>
</controls:Pivot.HeaderTemplate>
</controls:Pivot>
You can set the header of a Pivot control to pretty much anything since it is an object. To set it to an image instead of a default title set the Title to "" and do this in the constructor of your page:
YourPivotControl.Title = new Image { Width = 400, Source = new BitmapImage(new Uri("/someImage.png", UriKind.Relative)) };
Did you take a look at the default pivot page setup by visual studio? They do exactly what you're looking for:
<!--Pivot Control-->
<controls:Pivot Title="MY APPLICATION">
<!--Pivot item one-->
<controls:PivotItem Header="first">
<!--Double line list with text wrapping-->
<ListBox x:Name="FirstListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="78">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PivotItem>

Resources