private static void ElementMouseLeftButtonDown(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);
                }
            }
        }
Exemple #2
0
        private void onPreApplyTemplate()
        {
            if (!_appliedTemplate)
            {
                _appliedTemplate = true;

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

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