我有一个ScrollViewer
,里面有ItemPresenter
。
ItemsPresenter
包含一些下拉菜单,当我打开其中的一个下拉菜单时,我想禁用父级ScrollViewer
的滚动,仅在关闭下拉框后才重新启用它。
说“禁用”是指完全阻止滚动(即使使用鼠标滚轮也是如此)。
我尝试将VerticalScrollBarVisibility
设置为Disabled
,如下所示:
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Disabled">
<ItemsPresenter />
</ScrollViewer>
但这也不起作用。
它只是隐藏了滚动条,但是鼠标滚轮仍然有效。
那么,有没有办法完全禁用ScrollViewer
的滚动?
这是我的完整代码:
<ListView.Template>
<ControlTemplate>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="{Binding IsScrollEnabled, Converter={StaticResource BoolToVisibilityConverter}}">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ListView.Template>
答案 0 :(得分:1)
您可以通过处理<>
的{{1}}事件来禁用滚动。
min_val_normal = plot_normalized_table[['Min']]
max_val_normal = plot_normalized_table[['Max']]
original_normal = plot_normalized_table[['Original Label']]
interval_normal = plot_normalized_table[['Interval Size']]
normal_predicted = predicted_values[0:50]
fig = plt.figure(1, figsize = (18,10)) # Figure size in inches (size_x, size_y)
ax = plt.axes()
#predicted_values = PLS_Model1.predict(X_test) #Predictions from test data (run at least once for the plot to work)
plt.plot(min_val_normal, label = "Min", color='blue')
plt.plot(max_val_normal, label = "Max", color='red')
plt.plot(original_normal, label = "y", color = "black")
plt.plot(normal_predicted, label = "y\u0302", marker='o', )
plt.title('Normalized Final Conformal Predictions')
plt.xlim([-1, 51])
plt.ylim([-1, 2])
plt.legend()
plt.show()
PreviewMouseWheel