To create a circle below each time the button is clicked. In canvas
position of Circle move to out of canvas.
But, Scroll viewer does not move up and down.
<ScrollViewer x:Name="scv" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="135,0,0,0" Focusable="True">
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="373" VerticalAlignment="Top" Width="685" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True"/>
</ScrollViewer>
Is there a way to move up and down the scroll Viewer?
edit
An attempt was made to try to use the code to the link to me the site, an error occurs
don't use code... Anything simple way?
Related
I'm developing a touch application that uses a ScrollViewer and a StackPanel to make a carousel of images. The images are added to the stackpanel and the user slides them using fingers.
The problem is that I'm having a visual problem, what I want is to prevent the scrollviewer from stopping in the middle of two images. Just like this:
The idea is: when the inertia is stopping, automatically scroll to the nearest image.
Thats my XAML:
<ScrollViewer x:Name="crlGalleryPlayer1" Panel.ZIndex="303" HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden" PanningMode="HorizontalOnly"
PanningDeceleration="0.01" PanningRatio="1"
ManipulationBoundaryFeedback="crlCarrusel_Viewer_ManipulationBoundaryFeedback"
IsManipulationEnabled="True" Width="1920" Height="1080" Margin="0,0,0,0" CanContentScroll="False" Visibility="Hidden">
<StackPanel Name="pnlCarrusel_ViewerPlayer1" Visibility="Visible"
ScrollViewer.IsDeferredScrollingEnabled="False" IsManipulationEnabled="True" Margin="0,0,0,0"
Orientation="Horizontal" Panel.ZIndex="303">
</StackPanel>
</ScrollViewer>
I've tried to start from the ManipulationCompleted event of the Scrollviewer but it's not getting fired, only ManipulationStarted
Thank you all.
I'm facing problem with scrolling content in Dock panel .
My controls placed in 'DockPanel' as below
<DockPanel>
<ScrollViewer>
<StackPanel>
<!-- Here controls are like Radiobutton,Lable ,CheckBox,Textblock are added dynamically in grid.-->
</StackPanel>
</ScrollViewer>
I'm using only vertical scrollbar, not need horizontal scrollbar,
When I first time traverse through controls in 'DockPanel' by using tab ,Tab focus goes off the screen but panel is not scrolling down.
Please help me out I'm really stuck over here.
Thanks in advance.
Add IsTabStop="True" in Scrollviewer:
<DockPanel>
<ScrollViewer IsTabStop="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<StackPanel></StackPanel>
</ScrollViewer>
</DockPanel>
Page scrolls without any issue when the mouse is over data grid. If the mouse outside datagrid page doesn't scroll.
<navigation:Page>
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ScrollViewer x:Name="scrollMainQueue" VerticalScrollBarVisibility="Auto" >
<StackPanel>
<StackPanel>
</StackPanel>
.......
<StackPanel>
<data:DataGrid AutoGenerateColumns="False" Name="grdWorkingDocs" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="50" Margin="5,0,5,5" CanUserResizeColumns="False" CanUserReorderColumns="False" LoadingRow="grdWorkingDocs_LoadingRow" AlternatingRowBackground="White" RowBackground="White" HorizontalGridLinesBrush="White" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" />
</StackPanel>
</StackPanel>
......
</StackPanel>
</ScrollViewer>
</Grid>
scrollMainQueue.SetIsMouseWheelScrollingEnabled(true);
After some research Got the answer.
Basically we need to set the background color to the scrollviewer. It worked after that.
<ScrollViewer x:Name="scrollMainQueue" VerticalScrollBarVisibility="Auto" Background="White">
Answer is as mentione above. Applied background color to scrollviewer made is scrollable.
Background="Transparent" also works, if you can't use any color because of your design requirements.
I was using the Content Control to hold the inner view wrapped up with scroll viewer, the scroll viewer was only working on mouse wheel when the pointer is on any field and not on the empty area.
After seeing the above posts, I set the background color and it started working fine, though the solution looks unrelated [don't know how exactly related to the problem].
Here's my layout.
<Window>
<StackPanel Orientation="Vertical">
<StackPanel HorizontalAlignment="Stretch" Height="30">
</StackPanel>
<Canvas HorizontalAlignment="Center" Width="1020">
<!--i want this to take the remaining full height of the screen-->
<Canvas x:Name="bottomInfoBar" Canvas.Bottom="0" Width="720" Height="39">
<!--I want this at the very bottom of the screen-->
</Canvas>
</Canvas>
</Window>
I want the canvas to take the full height of the window so that the 'bottomInfoBar' always remains at the very bottom of the user's screen. However if i don't specify a height for the canvas 'bottomInfoBar' appears at the very top. How do i achieve this? Please help.
Easiest way:
<Window>
<DockPanel>
<Whatever x:Name="bottomInfoBar" DockPanel.Dock="Bottom"/>
<PrimaryContent/>
</DockPanel>
</Window>
Based on your question, you really should read about WPF's layout system before you write another line of code. You'll save yourself a world of pain if you understand that before proceeding.
I am developing a simple WPF application without any auto layout. The goal is when a user clicks (mouse down) a element (say textBlock) will appear at the location of the mouse click. For this I am using canvas panel embedded in a Grid of 1 row, 1 column and scrollviewer (visible). The issues are:
1. when the application window is resized the scroll viewers do not become active.
2. I want the ability to auto grow the canvas with mouse drag. Something like in MS-Excel when user drags the mouse horizontally/vertically the canvas should grow.
I have searched net a lot to figure this out and am unable to get an answer. Any help in this regard would be great.
Thanks a bunch in advance.
-P
I after asking this question I figured it out how to have freeform layout and autosize. Here is a sample XAML if anyone needs it or has better suggestion to improve this:
<Ellipse Grid.Column="0" Fill="Red"/>
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch"/>
<!-- Creating a grid with one row and one column"-->
<ScrollViewer x:Name="ServerLiistCanvasScrollViewer"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
Height="Auto" Width="Auto"
Grid.Column="2" >
<Grid x:Name="drawingGrid" Grid.Column="2"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
Background="Pink"
MouseDown="handleCanvasMouseDown">
</Grid>
</ScrollViewer>
</Grid>