I'm developing a control that will run on a touch device on which all the thouch effects have been disabled.
In this control i need a GridView so actually I'm evaluating your library that seems to fit my needs except for one thing:
How can I disable the "Tap and Hold" gesture or at least prevent that displays a circle? (I'm working with Q2 2013 libraries)
Regards,
John
4 Answers, 1 is accepted

I have a RadGridView with one GridViewComboBoxColumn:
<
telerik:GridViewComboBoxColumn
Width
=
"*"
IsCustomSortingEnabled
=
"False"
Header
=
"An header"
EditTriggers
=
"None"
>
<
telerik:GridViewComboBoxColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadComboBox
TouchDown
=
"Combobox_TouchDown"
>
<
telerik:RadComboBoxItem
Content
=
"one"
/>
<
telerik:RadComboBoxItem
Content
=
"two"
/>
<
telerik:RadComboBoxItem
Content
=
"three"
/>
<
telerik:RadComboBoxItem
Content
=
"four"
/>
</
telerik:RadComboBox
>
</
DataTemplate
>
</
telerik:GridViewComboBoxColumn.CellTemplate
>
</
telerik:GridViewComboBoxColumn
>
where the "Combobox_TouchDown" method is:
private
void
Combobox_TouchDown(
object
sender, TouchEventArgs e)
{
RadComboBox touchedControl = e.Source
as
RadComboBox;
touchedControl.IsDropDownOpen = !touchedControl.IsDropDownOpen;
}
Now if I Tap on the RadComboBox and then I "Tap and Hold" over the DropDown menu of the combobox i get the followin exception:
InvalidOperationException
This Visual is not connected to a PresentationSource.
Is there a way to disable that gesture?
We are still working on improving the Touch experience for our controls and currently, the only option is to turn off Touch handling completely(TouchManager.SetIsTouchHitTestVisibleProperty). This will disable the touch gestures like TapAndHold, Kinetic Scrolling etc. and will delegate the Touch input to Mouse events, like the WPF works by default.
Nevertheless, a sample project with the described error, and suggestions for improvement, or requirements for out touch mechanism will be greatly appreciated.
Hope this makes sense!
Nik
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

Thanks for your answer, while I was writing the requested example I found who causes the problem.
Premise:
Having more than one combobox in my control, I want to close the dropdown menu of every combobox when it loses focus.
To achieve that premise I stored a reference to the last-opened combobox
and, when the user tap somewhere else in my control, I close that last-opened combobox
(since the "LostFocus" event seems to be not fired when tapping on the monitor after selecting a Combobox)
The Storing of this last-opened combobox seems to be reason causing the Exception since the control won't fire any exception if I tap and hold over a dropdown menu of a combobox whose reference is not stored.
Solutions may be:
- force the user to tap again over the combobox to close it without choosing an element
- like you said, turn off the Touch Handling
Since i can't attach a Zip file I post the entire code to reproduce the problem:
- create a WPF application
MainWindow.xaml
<
Window
x:Class
=
"SampleProject.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
>
<
Grid
>
<
telerik:RadGridView
Grid.Row
=
"0"
x:Name
=
"radGridView"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding FakeItemsSource}"
ShowGroupPanel
=
"False"
CanUserSortColumns
=
"False"
CanUserDeleteRows
=
"False"
IsFilteringAllowed
=
"False"
RowHeight
=
"35"
ShowInsertRow
=
"False"
ShowColumnSortIndexes
=
"False"
CanUserFreezeColumns
=
"False"
RowIndicatorVisibility
=
"Collapsed"
CanUserResizeColumns
=
"False"
CanUserResizeRows
=
"False"
CanUserSelect
=
"True"
PreviewTouchDown
=
"radGridView_PreviewTouchDown"
Stylus.IsPressAndHoldEnabled
=
"False"
SelectionUnit
=
"FullRow"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewComboBoxColumn
Width
=
"*"
IsCustomSortingEnabled
=
"False"
Header
=
"An header"
EditTriggers
=
"None"
>
<
telerik:GridViewComboBoxColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadComboBox
TouchDown
=
"Combobox_TouchDown"
>
<
telerik:RadComboBoxItem
Content
=
"one"
/>
<
telerik:RadComboBoxItem
Content
=
"two"
/>
<
telerik:RadComboBoxItem
Content
=
"three"
/>
<
telerik:RadComboBoxItem
Content
=
"four"
/>
</
telerik:RadComboBox
>
</
DataTemplate
>
</
telerik:GridViewComboBoxColumn.CellTemplate
>
</
telerik:GridViewComboBoxColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
Window
>
MainWindow.xaml.cs
using System.Windows;
using System.Windows.Input;
using Telerik.Windows.Controls;
using System.Collections.ObjectModel;
namespace SampleProject
{
/// <
summary
>
/// Interaction logic for MainWindow.xaml
/// </
summary
>
public partial class MainWindow : Window
{
#region field
private RadComboBox _lastComboboxOpened;
#endregion
#region prop
private ObservableCollection<
string
> _fakeItemsSource;
public ObservableCollection<
string
> FakeItemsSource
{
get { return _fakeItemsSource; }
set { _fakeItemsSource = value; }
}
#endregion
#region ctor
public MainWindow()
{
InitializeComponent();
FakeItemsSource = new ObservableCollection<
string
>() { "fake" };
this.DataContext = this;
}
#endregion
#region eventHandler
private void radGridView_PreviewTouchDown(object sender, TouchEventArgs e)
{
if (_lastComboboxOpened == null) return;
_lastComboboxOpened.IsDropDownOpen = false;
_lastComboboxOpened = null;
}
private void Combobox_TouchDown(object sender, TouchEventArgs e)
{
RadComboBox touchedControl = e.Source as RadComboBox;
touchedControl.IsDropDownOpen = !touchedControl.IsDropDownOpen;
_lastComboboxOpened = touchedControl;
}
#endregion
}
}
- tap on the combobox to open it
- tap and hold on the combobox dropdown menu to raise the exception+
- if you comment the line 47:
_lastComboboxOpened = touchedControl;
you can tap and hold the dropdown menu without raising any exception
Regards,
John
The behavior seems very strange indeed, and we will investigate it.
Keep in mind however that subscribing to Microsofts events (TouchDown/Up/Move/etc.), overrides our internal Touch logic, which can lead to various problems.
Again we are still at a very early point in our touch integration, and we are still working on improvements features, APIs, etc. Please stay tuned for updates in our next releases, in which we expect major improvements in our touch logic.
Hope this makes sense!
Nik
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>