c# - 图像的一部分内的 WPF ScrollableViewer

标签 c# wpf

我想在 WPF 中将一个可滚动的容器放在图像的顶部或图像内部。 然后用户将能够滚动容器,而图像将被固定。我不想实现的是模拟智能手机的内容。在这张图片中,智能手机是图片,容器似乎在这张图片中:

最好的做法是什么?

WPF container inside image

谢谢!

最佳答案

您可以将容器放在 ScrollViewer 标签内:

<Window x:Class="WpfApplication2.Test"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Test" 
        Height="300" 
        Width="300">
<Grid>
    <ScrollViewer HorizontalAlignment="Left" Height="299" Margin="10,10,0,0"
          VerticalAlignment="Top" Width="497">
        <StackPanel>
           //Contorls like image ,button etc
        </StackPanel>
    </ScrollViewer>
</Grid>

关于c# - 图像的一部分内的 WPF ScrollableViewer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35157478/

相关文章:

c# - 将非托管 System.IntPtr 字节向量复制到二维设备字节数组的 GPU 行中

wpf - 分层数据、catel 和 MVVM

wpf - 将 DataColumn.Caption 绑定(bind)到 DataGrid 标题

c# - 帮助组合框背后的 Action /事件

C# 基本的 Hello World 没有运行

c# - 如何检测 SQL Server 2008 中是否正在使用实体?

c# - 将简单的 xml 反序列化为 List<string>

c# - 为什么服务器端更改没有反射(reflect)在我的应用程序中?

c# - 如何清除 ElementHost 控件的内存泄漏

c# - 如何使用 Xaml 将列表绑定(bind)到 WPF TreeView ?