我有一个ScrollViewer在我的WPF应用程序中,我希望它具有像Firefox一样的平滑/动画滚动效果(如果你知道我在说什么).
我试图通过互联网搜索,我发现的唯一的事情就是:
如何在WPF中创建动画ScrollViewer(或ListBox)
它的工作原理相当不错,但我有一个问题-它的动画滚动效应,但ScrollViewer的Thumb直接去压点-我希望它是藏汉动画
我怎样才能引起ScrollViewer的Thumb被藏汉动画,或者是有相同性质/功能,我想工作的控制?
ScrollViewer我的自定义控件中有一个实例...我需要scorollview是否滚动到End?有什么办法吗?
我们正在开发一个WPF 4.5应用程序,该应用程序将在带有触摸屏监视器的Windows 8计算机上运行.
我们已按照MSDN上的说明禁用对RealTimeStylus的支持,因为我们有一些需要通过WM_TOUCH支持多点触控的视图.
问题是禁用RealTimeStylus支持似乎也会禁用用户使用触摸滚动ScrollViewer的功能 - 通常用户可以用手指平移ScrollViewers,但如果禁用RealTimeStylus支持,则似乎无法执行此操作.ScrollViewer的PanningMode设置为"Both".
是否可以在WPF应用程序中组合这些内容,还是它们是互斥的?
我有一个大的ListBox启用了垂直滚动,我的MVVM有New和Edit ICommands.我在集合的末尾添加了新项目,但是当我调用MVVM-AddCommand时,我还希望滚动条自动定位到End.我也从应用程序的其他部分创建一个可编辑的项目(通过调用带有特定行项的EditCommand),以便我的ListBoxItem使用DataTrigger进入编辑模式,但是如何将该特定行(ListBoxItem)带到视图中通过调整滚动位置.
如果我在View端进行,我可以调用listBox.ScrollInToView(lstBoxItem).但是从MVVM角度解决这个常见Scroll问题的最佳方法是什么.
我有一个ScrollViewer,我正在显示Vertical Scrollbar,现在我想改变系统的分辨率,我想得到滚动条的宽度.我通过他们提到的One StackOverflow Post来检查SystemParameters.ScrollWidth属性,但我再次找到他们的任何帮助.任何人都可以帮我解决我的问题.任何答案将不胜感激.
我有一个TextBlock内部的ScrollViewer,与拉伸到其窗口对准.我需要TextBlock表现如下:
TextBlock保持a MinWidth和滚动条的需要TextWrapping或者TextTrimming应该适当地工作我该如何获得此功能?
我尝试了几种方法,包括绑定到ActualWidth&ActualHeight,但无法使其工作.
这不是那么困难,我错过了什么?
这是一个放在XamlPad中的代码示例(尚未设置MinWidth):
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<TextBlock TextWrapping="Wrap" Text="Some really long text that should probably wordwrap when you resize the window." />
</ScrollViewer>
</Window>
Run Code Online (Sandbox Code Playgroud) 我有一个滚动查看器,里面有几个列表框.问题是如果用户使用鼠标中键滚动滚动查看器,而鼠标位于列表视图上方.列表视图将其内部滚动查看器滚动到底部,然后继续捕获鼠标,防止包含滚动查看器滚动.
关于如何处理这个问题的任何想法?
我已经玩了地图,我用它ScrollViewer在地图上移动,我希望ViewBox一起使用它PinchManipulations来放大和缩小地图.到目前为止,我已经通过设置这样做ScrollViewer的Manipulation模式control,但是这给了我一个滞后,当我放大.有没有办法让这个ViewBox和ScrollViewer更好地一起工作,从而避免滞后?我到目前为止的代码是:
ScrollViewer中:
<ScrollViewer Grid.Column ="0" Width="768" Height="380" HorizontalScrollBarVisibility="Hidden">
<Viewbox Stretch="None">
<View:Map/>
</Viewbox>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
PinchZoom:
<Grid x:Name="Map" Width="1271" Height="1381.5">
<Grid.RenderTransform>
<ScaleTransform ScaleX="{Binding Path=deltaZoom}" ScaleY="{Binding Path=deltaZoom}"/>
</Grid.RenderTransform>
<i:Interaction.Triggers>
<i:EventTrigger EventName="ManipulationStarted">
<cmd:EventToCommand Command="{Binding Path=ZoomStartedCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
<i:EventTrigger EventName="ManipulationDelta">
<cmd:EventToCommand Command="{Binding Path=ZoomDeltaCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
<i:EventTrigger EventName="ManipulationCompleted">
<cmd:EventToCommand Command="{Binding Path=ZoomCompletedCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Grid>
Run Code Online (Sandbox Code Playgroud)
我使用捏缩放的代码:
public ICommand ZoomStartedCommand { get; set; }
public ICommand ZoomDeltaCommand { get; set; } …Run Code Online (Sandbox Code Playgroud) 我正在编写自定义WPF ItemsControl以显示项目列表.这些项目显示在ScrollViewer中:
<Style TargetType="MyCustomItemsControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MyCustomItemsControl">
<ScrollViewer x:Name="PART_MyScrollViewer" >
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
我想确保当我将鼠标移动到控件中时,特定项目(标记为已选中)将滚动到鼠标位置.在我的OnMouseEnter方法中,我能够找到该项目,但我不知道下一步该做什么.有谁有想法吗?
protected override void OnMouseEnter(MouseEventArgs e)
{
for (int i = 0; i < Items.Count; i++)
{
ContentPresenter uiElement = (ContentPresenter)ItemContainerGenerator.ContainerFromIndex(i);
var item = uiElement.Content as MyCustomObject;
if (item.IsSelected)
{
// How to scroll the uiElement to the mouse position?
break;
}
}
}
Run Code Online (Sandbox Code Playgroud) 我已经完成了这个帖子:
它几乎有助于实现目标,但仍然缺少一些东西.这是左右或上下移动滚动条给出了我的两个滚动查看器中滚动的预期行为,但是当我们尝试在滚动查看器中滚动使用/单击这些滚动条末端的箭头按钮时,只滚动一个滚动查看器预期的行为.
那么我们需要添加/编辑以解决这个问题呢?