I'm trying to implement autoscrolling and snapping to images in a windows phone 8 app
I currently have couple of images in a stackpanel inside a scrollviewer, and I'd like them to auto scroll horizontally every certain amount of time [5 seconds for example] while still being able to scroll and snap manually
this is what I have so far
<ScrollViewer x:Name="featuredScroll" Grid.Row="2" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled" >
<StackPanel x:Name="featuredStack" Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Image">
<Setter Property="Margin" Value="0,0,5,0"/>
</Style>
</StackPanel.Resources>
<Image Source="http://www.google.com/images/srpr/logo4w.png"/>
<Image Source="http://www.google.com/images/srpr/logo4w.png"/>
<Image Source="http://www.google.com/images/srpr/logo4w.png"/>
</StackPanel>
</ScrollViewer>
[images are placeholders]
so what I have now shows a scrollable list of those images [banners] which I can scroll horizontally, any idea how to achieve that ?
http://www.c-sharpcorner.com/UploadFile/5439e6/image-slideshow-using-dispatchtimer-in-windows-store-apps/
How about this option? This is example for Win store apps, but i don't see the reason why you couldn't rewrite it to WP
Related
I am working on a Windows 8 Store App. I want to use sliding panel for my application such as facebook mobile application leftside menu or rightside friends list. What am i want to do ? When i click to button panel should open left 0 to right side about 300px but i didn't find any solution for this. Can you help me for this ? Thx inadvance.
I SOLVED
Actually, I don't want to work with scrollview i want to show a setting pane. I solved my problem with using settingflyout. So, you can use basicly in your project. Add new item >> add settingflyout. But thx for your answer.
<ScrollViewer
x:Name="HorizontalScrollViewer"
VerticalScrollBarVisibility="Auto"
VerticalScrollMode="Disabled"
ZoomMode="Disabled"
HorizontalScrollBarVisibility="Auto"
HorizontalScrollMode="Auto"
HorizontalSnapPointsAlignment="Near"
HorizontalSnapPointsType="Mandatory">
<StackPanel
Orientation="Horizontal">
<Grid
x:Name="LeftPanel">
...
</Grid>
<Grid
x:Name="CenterPanel">
<ListView .../>
</Grid>
<Grid
x:Name="RightPanel">
...
</Grid>
</StackPanel>
</ScrollViewer>
I try to understand how windows phone viewport control Bounds work.
So i can give
viewport.Bunds = new Rect(x,y,width, height);
but what that bound stand for is it a scrollable area in the viewport.
Can anyone give me a working simple example of it cause whenever i try to use this parameter i can't scroll in viewport whatsover
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0">
<ViewportControl Name="tuzik" Bounds="0,0,300,400" Margin="66,117,20,41" >
<Canvas Name="canvas">
<Image Name="TestImage" Source="Assets\testimage.jpg"
HorizontalAlignment="Left" VerticalAlignment="Top"
Canvas.Left="-379" Canvas.Top="-769" Stretch="Fill" />
</Canvas>
</ViewportControl>
<Rectangle x:Name="rect" Width="300" Height="400" Margin="60,111,63,0" Stroke="Aqua" />
</Grid>
I believe your problem is the Canvas within the ViewportControl. Canvas does not expand to fill the ViewportControl and will not expand to contain the contents, either. You have to set a Width and Height on the Canvas.
(At least, that's how I have mine setup.)
I am working on Panorama App for Windows Phone 8 and I have to add Foreground image with the background image.I have successfully added the background image but i don't know how to add foreground image in the same layout.Please help.
<phone:Panorama Title="My_app">
<phone:Panorama.Background>
<ImageBrush ImageSource="/My_app;component/Assets/texture.png"/>
</phone:Panorama.Background>
Using this code i am adding background image but don't know how to add foreground image.
I want to add image in the place of title "My_App" .
To set an image instead of a text as title on a panorama control, just add a style to the panorama with a custom title template. For example you can do this by adding the following to the xaml of the page containing the panorama (note: the dots represent any other code):
<phone:PhoneApplicationPage>
...
<phone:PhoneApplicationPage.Resources>
...
<Style TargetType="phone:Panorama" >
<Setter Property="TitleTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Image Source="Assets/logo.png" Stretch="None" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
...
</phone:PhoneApplicationPage>
Hope this helps!
First, add a PanoromaItem, then add an image to that item:
<phone:PanoramaItem>
<Grid>
<Image x:Name="MyImage" />
</Grid>
<phone:PanoramaItem>
I'm Trying to design the Conversation View for a chat Application in windows 8 Metro App. I'm new to xaml designs, how to set the Conversation view like the image below,
Although at first time it seems this layout can be fit into Grid with three columns, I'm sure you would need scrolling at some point. So, you can just use Canvas, which allows free-floating controls. Place them with Canvas.Left and Canvas.Top attached properties.
Update: an illustration of what I mean:
<Canvas Width="300" Height="200">
<Border Width="40" Height="40" Canvas.Left="10" Canvas.Top="60" Background="Red"/>
<Border Width="160" Height="80" Canvas.Left="60" Canvas.Top="60" Background="LightGray"/>
<Border Width="40" Height="40" Canvas.Left="250" Canvas.Top="150" Background="Red"/>
<Border Width="160" Height="30" Canvas.Left="80" Canvas.Top="150" Background="LightGray"/>
</Canvas>
Let's pretend that red borders are user pics (put Image inside) and gray borders are messages (put RichTextBlock inside.) Canvas allows you to shift those blocks freely.
I have added a ListView to a Metro Style Blank App. Added to the ListView are 3 Strings. I want to change the LineHeight , but cannot find a property. Below is my xaml code.
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<ListView HorizontalAlignment="Left" Height="277.167" Margin="235.51,161,0,0" VerticalAlignment="Top" Width="100" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
<ListView.RenderTransform>
<CompositeTransform SkewX="-0.338" TranslateX="-0.327"/>
</ListView.RenderTransform>
<x:String>test 1</x:String>
<x:String>Test2</x:String>
<x:String>Test3</x:String>
</ListView>
</Grid>
How do I decrease, increase the line height of the strings in the ListView box? I want to decrease the space between the lines.
Thanks
Try editing a ItemContainerTemplate and then play with the properties available like margin and padding.
See my answer here :
WPF ComboBox customization in windows8
let me know in case you need any help.