I am using FlipView to show items (adding flip view item from code) and using VirtualizingStackpanel. when I change the View (snapView and fullmode) will clear flipview items using FlipView.Item.Clear() and do some size calculation and again add items in the flipview. The issue is i am not able to see the item after this and if i tap to the other item and coming back i am able to see the item. Any idea what is causing the issue?
<FlipView x:Name="fp" Margin="120,0,100,0" Visibility="Visible" SelectionChanged="onSelectionChanged">
<FlipView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel x:Name="FlipView2ItemsPanel" Background="Transparent" Orientation="Horizontal" >
</VirtualizingStackPanel>
</ItemsPanelTemplate>
</FlipView.ItemsPanel>
</FlipView>
Related
I put StackPanel into ScrollViewr, When scrolling to last item it returns back to its old position.
<ScrollViewer Margin="0,0,0,20">
<StackPanel>
//Textblocks and Textboxes ...
</StackPanel>
</ScrollViewer>
After search i found that:
ItemsControl, VirtualizingStackPanel and ScrollViewer height
I changed my code to:
<StackPanel>
//Textblocks and Textboxes ...
</StackPanel>
<ScrollViewer>
<VirtualizingStackPanel />
</ScrollViewer>
I can't set CanContentScroll="True" as i can't find it.
Also make exception:
System.InvalidOperationException: A VirtualizingPanel is not nested in an ItemsControl. VirtualizingPanel must be nested in ItemsControl to get and show items.
What must i do, to enable scrolling without returning back to its old position?
Regards,
After search again ...
I found this Post which solve the problem of Scrolling return to old position when open keyboard.
Scrolling page with keyboard shown
code after updates:
<ScrollViewer Height="500" VerticalAlignment="Top">
<StackPanel Height="700">
//Textblocks and Textboxes ...
</StackPanel>
</ScrollViewer>
I have Windows Phone 8 page which has a number of controls on it, some of them are LongListSelector controls. If all collections have content everything is displayed correctly.
But if any of the collections bound to the lists are empty all controls below them on the page disappear, i.e. the page looks to be truncated as lots of things are missing.
If I add code to make sure to add at least on item to each collection the page display correctly.
The databinding is done using C#, as shown below.
XAML
<phone:LongListSelector Grid.Row="3" x:Name="PicturesGrid">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Image Source="{Binding Filename}" />
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
C#
PicturesGrid.ItemsSource = App.ViewModel.SelectedBird.Pictures;
Update: I have noticed that there is a scrollbar present, but however much I scroll I never get down to the bottom.
I have a ListView in my XAML that contains multiple thumbnail images, after selecting some pictures with a Picker. My issue is that, I have changed the item panel template like below, and now the animations for adding of deleting an item, simply won't work. The items just pop in or disappear...
Here's how my ListView look like :
<ListView x:Name="ThumbnailsListView"
ItemTemplate="{StaticResource ImageTemplate}"
ItemsSource="{Binding Images}"
SelectionMode="Multiple"
SelectionChanged="OnThumbnailsSelectionChanged">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" >
<WrapGrid.ChildrenTransitions>
<TransitionCollection>
<ContentThemeTransition/>
</TransitionCollection>
</WrapGrid.ChildrenTransitions>
</WrapGrid>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
What could be wrong? If I cut down the part with the ItemsPanelTemplate the animations are OK but the visual effect is not the one desired.
I wish that items would fill the panel horizontally and then proceed to the next line.
You need to get other transitions in your ChildrenTransitions collection, like AddDeleteThemeTransition.
For a windows 8 Apps, i need to put a list of buttons over an image. Each button has CoordinateX and CoordinateY properties. I use a gridView to bind to the list of buttons.
I need to have the result as below:
Here is my code:
<Grid HorizontalAlignment="Left" VerticalAlignment="Top" >
<Canvas>
<Image Source="ms-appx:///Assets/red.png" Stretch="None" ></Image>
<GridView ItemsSource="{Binding Buttons}"
SelectionMode="None" IsSwipeEnabled="false" IsItemClickEnabled="True" ItemClick="Button" Padding="0">
<GridView.ItemTemplate>
<DataTemplate>
<Button Width="194" Height="51" Background="Gray" Canvas.Left="{Binding CoordinateX}" Canvas.Top="{Binding CoordinateY}"></Button>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</Canvas>
</Grid>
But this is what i get after running the app:
Ites Likely that at runtime before the X and Y co-ordinates can be set for the items within the GridView, the GridView itself has its properties applied.
Since
1) the GridView is intended to be used for oganization control
and
2) you havent forced the Grid to fill the view space
what you're left with is a GridView that acts as it wishes and limits the ability of its items to conform to your style, should the style attempt to force the items collection to live outside the bounds of the control.
You could try to set the GridView's Horizontal Alignment property but even if it happens to work, its probably a better bet to use a less organized content control like the more basic ItemsPresenter.
Which ever control you end up using... make sure to check for /set the HorizontalContentAlignment & VerticalContentAlignment properties if they exist.
How set the Panorama page Background for User control which is inside the PanoramaItem ?
I had put one user control in Panorama Item. I expect that the same panoroma background is applied to user control, but its not, there is a difference..? how to set the normal Panorama Back ground to the user control which is bound to the panorama item.
<controls:Panorama Grid.Row="1">
<!--Panorama item one-->
<controls:PanoramaItem Header="{Binding Path= Localizedresources.RecentPanoramaItemHeader, Source={StaticResource LocalizedResources}}">
<views:RecentFileView DataContext="{Binding RecentFileViewModel}" />
</controls:PanoramaItem>
<!--Panorama item two-->
<controls:PanoramaItem Header="{Binding Path= Localizedresources.FileserversPanoramaItemHeader, Source={StaticResource LocalizedResources}}">
<views:DashboardView DataContext="{Binding DashboardViewModel}" />
</controls:PanoramaItem>
<!--Panorama item three-->
<controls:PanoramaItem Header="{Binding Path= Localizedresources.MenuPanoramaItemHeader, Source={StaticResource LocalizedResources}}">
<Grid>
</Grid>
</controls:PanoramaItem>
<!--Panorama item four-->
<controls:PanoramaItem Header="{Binding Path= Localizedresources.TheftguardPanoramaItemHeader, Source={StaticResource LocalizedResources}}">
<Grid/>
</controls:PanoramaItem>
</controls:Panorama>
While I am running the application I can see the difference in Back ground of user control. I need the same feel as Panorama not the user control. for that I need the back ground of user control is same as Panorama. - while applying light theam to phone.
I need a transparent background of user control.
I suspect that one (or more) of your UserControls has a Background value set on the root element. The default UserControl that gets added in Visual Studio has the Background property on the root Grid (named LayoutRoot) set: Background="{StaticResource PhoneChromeBrush}", which is not transparent. If you simply remove the Background property, the UserControl will become transparent: <Grid x:Name="LayoutRoot">.