public void BringIntoView(Expander slidcontents) { SliderPanel slid = this;//PayrollManager.Common.FindChild<SliderPanel>(MainView, "Slider"); if (slidcontents.IsExpanded == false) { return; } // double sl = VisualTreeHelper.GetOffset(slidcontents).X*-1; double sl = slidcontents.TransformToAncestor(slid.Parent as Visual).Transform(new Point(0, 0)).X * -1; // Canvas.SetLeft(slidcontents, -1800); //slid.MouseStart = new Point(0, 0); //slid.MouseNow = new Point(-1800, 0); FrameworkElement sp = (FrameworkElement)slid.Parent; FrameworkElement exp = ((FrameworkElement)slidcontents.Content); if (sl * -1 > (sp.ActualWidth - exp.ActualWidth)) { slid.MoveControls(sl + sp.ActualWidth - ((FrameworkElement)slidcontents.Content).ActualWidth); } if (sl * -1 < 0) { slid.MoveControls(sl + navWidth); } ppctl = slidcontents.Name; pctl.Push(slidcontents.Name); }
public void MoveTo(string ctl) { SliderPanel slid = this;//PayrollManager.Common.FindChild<SliderPanel>(MainView, "Slider"); Expander slidcontents; if (ctl == "ReportBRD") { Grid mainsales = PayrollManager.Common.FindChild <Grid>(slid, "MainSalesContents"); slidcontents = PayrollManager.Common.FindChild <Expander>(mainsales, ctl); } else { slidcontents = PayrollManager.Common.FindChild <Expander>(slid, ctl); } // double sl = VisualTreeHelper.GetOffset(slidcontents).X*-1; double sl = (double)(slidcontents?.TransformToAncestor(slid.Parent as Visual).Transform(new Point(0, 0)).X * -1); // Canvas.SetLeft(slidcontents, -1800); //slid.MouseStart = new Point(0, 0); //slid.MouseNow = new Point(-1800, 0); slid.MoveControls(sl + navWidth); slidcontents.IsExpanded = true; ppctl = ctl; pctl.Push(ctl); }