gpt4 book ai didi

c# - 滚动查看器 XAML : MouseWheel Not Working

转载 作者:行者123 更新时间:2023-11-30 15:32:02 25 4
gpt4 key购买 nike

我正在为小型企业开发应用程序,但我遇到了水平滚动查看器的问题。

水平滚动查看器出现在屏幕上,但鼠标滚轮不起作用。

我有这个 XAML 代码:

<ScrollViewer ScrollViewer.ZoomMode="Disabled" HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto" ScrollViewer.IsHorizontalScrollChainingEnabled="True" VerticalScrollBarVisibility="Disabled" Margin="0,130,0,0" VerticalContentAlignment="Stretch" ManipulationMode="All">
<Grid Width="1000" HorizontalAlignment="Left" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250*" ></ColumnDefinition>
<ColumnDefinition Width="250*"/>
<ColumnDefinition Width="250*"/>
<ColumnDefinition Width="250*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="65*" />
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="45*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20,0,0,0" Text="Στοιχεία Πελάτη" FontSize="50"></TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Όνομα :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Επώνυμο :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Τηλέφωνο :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Κινητό :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="0" Grid.Row="5" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Διεύθυνση :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="0" Grid.Row="6" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Πόλη :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Χώρα :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="2" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Email :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="2" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Α.Φ.Μ :" FontSize="30"></TextBlock>
<TextBlock Grid.Column="2" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center" Text="ΔΟΥ:" FontSize="30"></TextBlock>
<TextBlock Grid.Column="2" Grid.Row="5" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Περιγραφή:" FontSize="30"></TextBlock>
<TextBox Grid.Column="1" Grid.Row="1" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="2" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="3" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="4" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="5" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="6" Height="30"></TextBox>
<TextBox Grid.Column="3" Grid.Row="1" Height="30"></TextBox>
<TextBox Grid.Column="3" Grid.Row="2" Height="30"></TextBox>
<TextBox Grid.Column="3" Grid.Row="3" Height="30"></TextBox>
<TextBox Grid.Column="3" Grid.Row="4" Height="30" VerticalAlignment="Center"></TextBox>
<TextBox Grid.Column="3" Grid.Row="5" Grid.RowSpan="4" AcceptsReturn="True" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Visible"/>
<Button Grid.Column="3" Grid.Row="9" Content="Αποθήκευση" FontSize="22" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></Button>
</Grid>
</ScrollViewer>

有什么问题吗?

最佳答案

除了确保您的滚动查看器以固定宽度呈现,从而在查看器本身内启用滚动(目前看起来查看器不需要滚动来显示内容),将查看器声明更改为以下。

 <ScrollViewer 
Style="{StaticResource HorizontalScrollViewerStyle}"
ScrollViewer.IsHorizontalScrollChainingEnabled="True"
Margin="0,130,0,0"
VerticalContentAlignment="Stretch"
ManipulationMode="All">

样式应在 StandardStyles.xaml 中定义,但如果您不使用该文件,则定义如下。

<Style x:Key="HorizontalScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
</Style>

关于c# - 滚动查看器 XAML : MouseWheel Not Working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19711974/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com