Esempio n. 1
0
        private static void element_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var element = (UIElement)sender;

            // find the ReoderListBox parent of the element
            var reorderListBox = TreeHelpers.FindParent <ReorderListBox>(element);

            if (reorderListBox != null)
            {
                // find the ItemContainer
                FrameworkElement f = TreeHelpers.GetItemContainerFromChildElement(reorderListBox, element) as FrameworkElement;
                if (f != null)
                {
                    reorderListBox.BeginDrag(f);
                }
            }
        }
Esempio n. 2
0
        private void onPreApplyTemplate()
        {
            if (!m_appliedTemplate)
            {
                m_appliedTemplate = true;

                DependencyObject source = base.TemplatedParent;
                if (source is ItemsPresenter)
                {
                    source = TreeHelpers.FindParent <ItemsControl>(source);
                }

                if (source != null)
                {
                    bindToParentItemsControl(ItemHeightProperty, source);
                    bindToParentItemsControl(ItemWidthProperty, source);
                }
            }
        }