private void OnMarkerViewportBoundsChanged(object sender, EventArgs e) { RecalculateViewportBounds(); FrameworkElement element = (FrameworkElement)sender; DataRect elementBounds = ViewportRectPanel.GetActualViewportBounds(element); DataRect prevElementBounds = ViewportRectPanel.GetPrevActualViewportBounds(element); }
protected void OnMarkerBind(BindMarkerEventArgs e) { var marker = e.Marker; //marker.SetBinding(ViewportRectPanel.ViewportVerticalAlignmentProperty, new Binding { Path = new PropertyPath("Value"), Converter = converter }); xValues.Add(ViewportRectPanel.GetViewportX(marker)); }
private void RecalculateViewportBounds() { DataRect bounds = DataRect.Empty; foreach (UIElement item in itemsPanel.Children) { DataRect elementBounds = ViewportRectPanel.GetActualViewportBounds(item); bounds.Union(elementBounds); } Viewport2D.SetContentBounds(this, bounds); }
protected void RebuildMarkers(bool shouldReleaseMarkers) { xValues.Clear(); base.RebuildMarkers(shouldReleaseMarkers); double width = 0; for (int i = 0; i < xValues.Count - 1; i++) { double currX = xValues[i]; double nextX = xValues[i + 1]; width = (nextX - currX); ViewportRectPanel.SetViewportWidth(ItemsPanel.Children[i], width); } if (ItemsPanel.Children.Count > 0) { ViewportRectPanel.SetViewportWidth(ItemsPanel.Children[ItemsPanel.Children.Count - 1], width); } }