How to Refresh Longlist Selector? - windows-phone-7

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?

Related

windows phone 8 scrollviewer hides my button

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>

Gridview with grid inside with ItemClick

My ItemView_ItemClick is not executed when I click on a tile (except if I click on the rectangle selector).
Why ? How can I do that ? Thanks.
<GridView Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Products}" IsItemClickEnabled="True" ItemClick="ItemView_ItemClick">
<GridView.ItemTemplate>
<DataTemplate>
<GridViewItem>
<Grid Width="300" Height="200">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding SmallPic, Converter={StaticResource imageConverter }}" Stretch="UniformToFill"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Opacity="1" Background="#7F000000" >
<TextBlock Text="{Binding Name}" Style="{StaticResource ItemContentStyle}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Margin="15,0,15,0"/>
<TextBlock Text="{Binding Price, Converter={StaticResource priceConverter }}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
</StackPanel>
</Grid>
</GridViewItem>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
Moving my comment to an answer....
The <GridViewItem> inclusion is unnecessary and seems to be causing the unwanted behavior.

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>
...

ListPicker doesn't expand in StackPanel on WP7

Another day another problem, this time I think with a simple issue into XAML formatting.
I have a ListPicker in a StackPanel on a XAML page in a WP7 app. Whenever I tap the ListPicker, it expands, but it appears to expand behind the item below it. If I have enough items in the list it opens in full screen mode which works fine.
Any suggestions, pointers would be appreciated;
<Grid Name="grdBought">
<StackPanel Visibility="Visible" Margin="0,0,0,0" Height="480">
<Button Name="btnSave" Grid.Row="0" Content="Save" Height="100" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="378" Click="btnSave_Click" />
<StackPanel Grid.Row="1" Orientation="Vertical">
<toolkit:ListPicker Name="CategoryPicker" Header="Select Category" HorizontalAlignment="Left" ItemsSource="{Binding Categories}" CacheMode="BitmapCache" TabIndex="0" Margin="0,0,0,0" SelectionChanged="CategoryPicker_SelectionChanged" Height="100" Width="195">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<TextBlock Text="{Binding CategoryDesc}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<StackPanel Name="item" Orientation="Vertical" Margin="0, 0, 0, 0">
<TextBlock Margin="0, 0, 0, 0" Text="{Binding CategoryDesc}" FontSize="40" TextWrapping="Wrap" />
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<StackPanel Name="Items" Grid.Row="1" Orientation="Horizontal">
<TextBox Name="txtDescription" Height="100" Margin="0,0,0,0" Text="" Width="225" MaxLength="100" FontSize="40" InputScope="Text" />
<TextBox Name="txtAmount" HorizontalAlignment="Left" Text="0.00" Height="100" Margin="0,0,0,0" TextAlignment="Right" FontSize="40" FontFamily="Segoe WP Semibold" Width="163" KeyUp="txtAmount_KeyUp" />
</StackPanel>
</StackPanel>
<TextBlock Name="tb1" Text="Amount" Height="27" Margin="0,0,0,0" Width="137" />
<Button Name="button1" Content="Button" Height="72" HorizontalAlignment="Left" Margin="249,0,0,0" VerticalAlignment="Top" Width="160" Click="button1_Click" />
</StackPanel>
I have been through the examples on the windowsphonegeek.com site, but I still can't make it work!
The issue is that you're setting the Height of the ListPicker to 100. Remove that, and just leave as auto. This is an issue b/c when you restrict the height, the listpicker has nowhere to expand (thus, showing the behavior you're seeing)
I guess height is creating an issue, just make sure that height of listpicker is greater than stackpanel.

Windows Phone: How to put another control at the bottom of a dynamic listbox

I have a listbox that is showing a dynamic list of data that can grow. At the bottom of this listobx, once the user has scrolled through all the items, I want to show a piece of text. And sometimes, depending on the situation, it can be a button or another listbox. But, I want to learn how to put a textbox first. I tried searching forums and tried, Grid, StackPanel, ScrollViewer. Nothing seems to work. This code here, looks promising but I am not able to scroll with this: This must be a common UI, I would guess. Any help?
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="tasteePic" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="I'm Hungry" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<ProgressBar Height="4" HorizontalAlignment="Left" Margin="10,10,0,0" Name="progressBar1" VerticalAlignment="Top" Width="460" />
</StackPanel>
<ScrollViewer Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Visible">
<StackPanel Margin="12,17,0,28">
<ListBox Name="MenuItemListBox" VerticalAlignment="Top" SelectionChanged="MenuItemListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image
Margin="4, 4, 4, 4"
Grid.Column="0"
delay:LowProfileImageLoader.UriSource="{Binding ThumbNailUrl}" />
<StackPanel>
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text="{Binding BusinessName}" />
<TextBlock Text="{Binding Price}" />
<TextBlock Text="{Binding Neighborhood}" />
<TextBlock Text="{Binding City}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text="Test" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
</ScrollViewer>
</Grid>
You can place your TextBox after the ItemsPresenter element of the ListBox by retemplating in Blend.
Here's a worked example.
How to add a Control at the end of Items of a ListBox (e.g. a "Load More" Button or Hyperlink)?

Resources