button in column not working on touch tablet

6 posts, 1 answers
  1. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 14 Apr 2015 Link to this post

    The application is written for a windows 8 tablet desktop.  I have applied the windows 8 touch theme in the code behind of my main window.

    StyleManager.ApplicationTheme= new Windows8TouchTheme();

     

    Started with a GridViewToggleRowDetailsColumn to open the detail of a row. Unfortunaltely the arrow is too small for the tablet and therefore the touch registration for the arrow would be very finicky. 

    Decided to create a custom gridview column that mimicked the behavior of the GridViewToggleRowDetailsColumn as authored in these forums many times. 

    public class InoToggleColumn: GridViewBoundColumnBase
    {
        public override object Header
        {
            get
            {
                return null;
            }
            set
            {
                base.Header = value;
            }
        }
     
        public InoToggleColumn()
        {
            EditTriggers = GridViewEditTriggers.None;
        }
     
        public override System.Windows.FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
        {
     
            var gvt = new RadToggleButton()
                { Margin = new System.Windows.Thickness(3) };
     
            gvt.SetBinding(RadToggleButton.IsCheckedProperty, DataMemberBinding);
     
            gvt.Checked += (sender, e) => _setImage((RadToggleButton)sender);
            gvt.Unchecked += (sender, e) => _setImage((RadToggleButton)sender);
     
            _setImage(gvt);
     
            var row = cell.ParentRow as GridViewRow;
            if (row != null)
            {
                row.SetBinding(GridViewRow.DetailsVisibilityProperty, new Binding("IsChecked")
                {
                    Source = gvt, Converter = new BooleanToVisibilityConverter(), Mode = BindingMode.TwoWay
                });
            }
            return gvt;
        }
     
        private void _setImage(RadToggleButton radToggleButton)
        {
            Image sourceImage;
            if(radToggleButton==null) return;
            if (radToggleButton.IsChecked == null) return;
     
            if (radToggleButton.IsChecked.Value)
            {
                sourceImage = new Image()
                {
                    Source =
                        new BitmapImage(new Uri(@"/InoAuto;component/Assets/Images/arrow-down.png",
                            UriKind.Relative)),Width = 40
                };
            }
            else
            {
                sourceImage = new Image()
                {
                    Source =
                        new BitmapImage(new Uri(@"/InoAuto;component/Assets/Images/arrow-right.png",
                            UriKind.Relative)),Width = 40
                };
            }
            radToggleButton.Content = sourceImage;
        }
     
        public override bool CanSort()
        {
            return false;
        }
     
        public override bool CanFilter()
        {
            return false;
        }
     
        public override bool CanGroup()
        {
            return false;
        }
     
     
         
    }

     

    It works fine with a mouse but when I move it to my windows 8 surface tablet.

    The Touchs do not register, the button does not toggle ,  and the detail is not displayed.

     

    Any assistance would be appreciated

     

    thanks

    dco
     

  2. Answer
    Nick
    Admin
    Nick avatar
    593 posts

    Posted 15 Apr 2015 Link to this post

    Hello David,

    The touch is being handled globally for RadGridView thus the button you have created in the CreateCellElement is not being recognized and it does not react to touch input. This behavior will be changed in Q2 2015.

    In the mean time you can workaround this by setting TouchManager.SetIsTouchHitTestVisible(gvt, false)

    Hope this helps.


    Regards,
    Nick
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 15 Apr 2015 in reply to Nick Link to this post

    that worked great.

    thanks nick

  5. Shaun
    Shaun avatar
    31 posts
    Member since:
    Jul 2011

    Posted 13 Jul Link to this post

    Hi Nick,

    Has this problem been fixed?

    I am currently using the TouchManager.SetIsTouchHitTestVisible(gvt, false) as a work around but this stops the gridview from being scrolled by touch.

    This is causing aggravation with end users as they expect to be able to scroll by touch. They currently have to go to the scrollbar to scroll which is not expected behaviour.

     

    Regards,

     

    Shaun

  6. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 18 Jul Link to this post

    Hello Shaun,

    Can you try setting TouchManager.TouchMode to None only for the button, not for the whole grid. In this way the scrolling should work correctly.

    Regards,
    Yoan
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  7. Shaun
    Shaun avatar
    31 posts
    Member since:
    Jul 2011

    Posted 30 Sep in reply to Yoan Link to this post

    Hi Yoan,

    Sorry for the late reply, I missed this post for some reason.

    I have just tried out what you mentioned and all seems good so far.

    Thanks for the help

     

    Shaun

Back to Top
UI for WPF is Visual Studio 2017 Ready