小编Chr*_*phe的帖子

WPF QuickConverter:在空列表中隐藏元素

我有一个StackPanel保存一个TextBox带有标题和ItemsControl与项目。如果提供项目的列表为空,我想隐藏整个 StackPanel。我不想为绑定编写专用的转换器,而是想尝试一下QuickConverter ( https://quickconverter.codeplex.com/ )。QuickConverter 允许在绑定中使用内联 C# 表达式。

所以这是我的标记:

<StackPanel Visibility="{qc:Binding '$P > 0 ? Visibility.Visible : Visibility.Collapsed', P={Binding Path=Value.Count}}"> <!-- this does not work. It's always shown, regardless of the element count -->
  <TextBlock Text="{qc:Binding '$P', P={Binding Path=Value.Count}}"></TextBlock> <!-- for debugging purposes only. It correctly shows the element count for the list -->
  <TextBlock Text="{qc:Binding '$P.Count', P={Binding Path=Value}}"></TextBlock> <!-- for debugging purposes only. It should do the same as the line above, but …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml

5
推荐指数
1
解决办法
1775
查看次数

WPF ScrollViewer滚动灵敏度

我正在开发一个WPF应用程序,用于带触摸屏的销售点.我在ScrollViewer中有一个带有产品按钮的ItemsControl.用户可以通过用手指拖动来滚动(平移)产品.要将产品添加到购物车,用户只需触摸产品按钮即可.到现在为止还挺好.

然而,由于触摸屏表面非常光滑和抛光,因此当试图按下按钮时,用户的手指有时会滑动一点点.在这种情况下,没有注册按钮单击.相反,ScrollViewer会滚动一小段动作.

现在,我的问题是:有没有办法降低ScrollViewer的灵敏度,因此需要更长的拖动才能启动滚动并抑制click事件.

谢谢你的建议!

最好的祝福,

克里斯

wpf scroll button scrollviewer

3
推荐指数
1
解决办法
1017
查看次数

标签 统计

wpf ×2

button ×1

c# ×1

scroll ×1

scrollviewer ×1

xaml ×1