Esempio n. 1
0
 public static UserEvent Create(ListView listView, AutomationPropertyChangedEventArgs eventArgs)
 {
     var columnPosition = (int) Mouse.instance.Location.X;
     if (listView.SelectedRows.Count == 0)
     {
         var listViewEvent = new ListViewEvent(listView, TryUnSelectAll, new object[] {});
         return listViewEvent;
     }
     if (true.Equals(eventArgs.NewValue))
     {
         string column = null;
         if (listView.Header != null)
         {
             ListViewColumn listViewColumn =
                 listView.Header.Columns.Find(obj => obj.Bounds.Left < columnPosition && columnPosition < obj.Bounds.Right);
             column = listViewColumn.Text;
         }
         string value = column == null ? listView.SelectedRows[0].Cells[0].Text : listView.SelectedRows[0].Cells[column].Text;
         return new ListViewEvent(listView, Select, new object[] {column, value});
     }
     return null;
 }
Esempio n. 2
0
        public static UserEvent Create(ListView listView, AutomationPropertyChangedEventArgs eventArgs)
        {
            var columnPosition = (int)Mouse.Instance.Location.X;

            if (listView.SelectedRows.Count == 0)
            {
                var listViewEvent = new ListViewEvent(listView, TryUnSelectAll, new object[] {});
                return(listViewEvent);
            }
            if (true.Equals(eventArgs.NewValue))
            {
                string column = null;
                if (listView.Header != null)
                {
                    ListViewColumn listViewColumn =
                        listView.Header.Columns.Find(obj => obj.Bounds.Left < columnPosition && columnPosition < obj.Bounds.Right);
                    column = listViewColumn.Text;
                }
                string value = column == null ? listView.SelectedRows[0].Cells[0].Text : listView.SelectedRows[0].Cells[column].Text;
                return(new ListViewEvent(listView, Select, new object[] { column, value }));
            }
            return(null);
        }