private void SetBindings(FrameworkElement marker, ViewportPanel panel) { panel.SetBinding(ViewportPanel.ViewportBoundsProperty, boundsMultiBinding); var crown = (Shape)marker; crown.SetBinding(ViewportPanel.ViewportWidthProperty, crownWidthBinding); crown.SetBinding(ViewportPanel.ViewportHeightProperty, crownHeightBinding); crown.SetBinding(ViewportPanel.YProperty, crownYBinding); crown.SetBinding(ViewportPanel.XProperty, xBinding); crown.SetBinding(Shape.FillProperty, fillBinding); crown.SetBinding(Shape.StrokeProperty, strokeBinding); panel.Children.Add(crown); var trunk = (Shape)trunkTemplate.LoadContent(); trunk.SetBinding(ViewportPanel.XProperty, xBinding); trunk.SetBinding(ViewportPanel.ViewportWidthProperty, trunkWidthBinding); trunk.SetBinding(ViewportPanel.ViewportHeightProperty, trunkHeightBinding); trunk.SetBinding(Shape.FillProperty, fillBinding); panel.Children.Add(trunk); }
protected override FrameworkElement CreateMarkerCore(object dataItem) { var panel = new ViewportPanel { DataContext = dataItem }; panel.SetBinding(ViewportPanel.ViewportBoundsProperty, boundsMultiBinding); var trunk = (Rectangle)trunkTemplate.LoadContent(); trunk.DataContext = dataItem; trunk.SetBinding(Shape.FillProperty, fillBinding); trunk.SetBinding(ViewportPanel.XProperty, xBinding); trunk.SetBinding(ViewportPanel.ViewportWidthProperty, trunkWidthBinding); trunk.SetBinding(ViewportPanel.ViewportHeightProperty, trunkHeightBinding); trunk.SetBinding(Shape.FillProperty, fillBinding); panel.Children.Add(trunk); var crown = (Path)crownTemplate.LoadContent(); crown.DataContext = dataItem; crown.SetBinding(Shape.FillProperty, fillBinding); crown.SetBinding(Shape.StrokeProperty, strokeBinding); crown.SetBinding(Path.DataProperty, crownPathDataBinding); crown.SetBinding(ViewportPanel.ViewportWidthProperty, crownWidthBinding); crown.SetBinding(ViewportPanel.ViewportHeightProperty, crownHeightBinding); crown.SetBinding(ViewportPanel.YProperty, crownYBinding); crown.SetBinding(ViewportPanel.XProperty, xBinding); crown.SetBinding(Shape.FillProperty, fillBinding); crown.SetBinding(Shape.StrokeProperty, strokeBinding); panel.Children.Add(crown); panel.SetBinding(ToolTipService.ToolTipProperty, speciesBinding); //LiveToolTip toolTip = new LiveToolTip(); //toolTip.SetBinding(LiveToolTip.BackgroundProperty, fillBinding); //toolTip.SetBinding(LiveToolTip.ContentProperty, speciesBinding); //toolTip.SetBinding(TextBlock.ForegroundProperty, foregroundBinding); //LiveToolTipService.SetToolTip(panel, toolTip); return panel; }