Exemplo n.º 1
0
        protected override void OnLostMouseCapture(MouseEventArgs e)
        {
            base.OnLostMouseCapture(e);
            PreviewMouseMove -= OnPreviewMouseMoveWhileCaptured;

            Suspended = false;

            ArtPanel panel = GetArtPanel(e.OriginalSource);

            if (panel != null)
            {
                if (panel.Parent == null)
                {
                    //The panel has been removed (probably due to image size changed), so find the new panel for that album art, and bring that into view instead
                    ContentPresenter contentPresenter = ItemContainerGenerator.ContainerFromItem(panel.AlbumArt) as ContentPresenter;
                    if (contentPresenter != null)
                    {
                        contentPresenter.BringIntoView();
                    }
                }
                else
                {
                    panel.BringIntoView();                     //Ensure the panel remains in view
                }
            }
        }
Exemplo n.º 2
0
        // Чтоб не выходили за поле зрения
        private void BringToView(CodeFile file)
        {
            object o = itemsControl.ItemContainerGenerator.ContainerFromItem(file);

            if (o != null)
            {
                ContentPresenter p = (o as ContentPresenter);
                p.BringIntoView();
            }
        }
Exemplo n.º 3
0
        public void LoadOrder(Order order, bool ScrollToEnd = false, int ScrollToIndex = -1)
        {
            if (MainScreen.ItemsInCart == null)
            {
                MainScreen.ItemsInCart = new ObservableCollection <ItemInCartModel>();
            }
            else
            {
                MainScreen.ItemsInCart.Clear();
            }

            foreach (var item in order.Cart)
            {
                AddItemToGuiCart(item);
            }

            MainScreen.Total = order.Total;
            MainScreen.Count = order.Cart.Count;

            //var point = item.TranslatePoint(new Point() - (Vector)e.GetPosition(sv), ip);
            //sv.ScrollToVerticalOffset(point.Y + (item.ActualHeight / 2));


            if (null != m_CartScroller)
            {
                if (ScrollToEnd)
                {
                    m_CartScroller.ScrollToEnd();
                }
                else if (ScrollToIndex != -1)
                {
                    ContentPresenter itemcontainer = ((ItemsControl)m_CartScroller.Content).ItemContainerGenerator.ContainerFromIndex(ScrollToIndex) as ContentPresenter;
                    if (itemcontainer != null)
                    {
                        itemcontainer.BringIntoView();
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void Dispatcher_HeaderClicked(object sender, EventArgs e)
        {
            ContentPresenter itemcontainer = AssociatedObject.ItemContainerGenerator.ContainerFromIndex(0) as ContentPresenter;

            itemcontainer?.BringIntoView();
        }