Пример #1
0
        public static Hashtable ElemListItemToHash(ElemListItem listItem)
        {
            Hashtable ElemHash = new Hashtable();

            PropertyInfo[] properties = listItem.GetType()
                                        .GetProperties();
            foreach (PropertyInfo prop in properties)
            {
                ElemHash.Add(prop.Name, prop.GetValue(listItem));
            }

            return(ElemHash);
        }
Пример #2
0
        private void lstElemList_DoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DependencyObject obj      = (DependencyObject)e.OriginalSource;
            Hashtable        ElemHash = new Hashtable();

            while (obj != null && obj != lstElemList)
            {
                if (obj.GetType() == typeof(ListViewItem))
                {
                    ElemListItem   Selected   = (ElemListItem)lstElemList.SelectedItem;
                    PropertyInfo[] properties = Selected.GetType()
                                                .GetProperties();
                    foreach (PropertyInfo prop in properties)
                    {
                        ElemHash.Add(prop.Name, prop.GetValue(Selected));
                    }
                }
                obj = VisualTreeHelper.GetParent(obj);
            }

            MessageBox.Show(TypeConverter.HashToString(ElemHash));
        }