Example #1
0
 private void DisplayBalloon(Slice slice, Point position) {
   balloon.Visibility = Visibility.Visible;
   balloon.Measure(new Size(canvasBorder.ActualWidth, canvasBorder.ActualHeight));
   double balloonLeft = position.X - balloon.DesiredSize.Width / 2;
   if (balloonLeft < 0) {
     balloonLeft = position.X;
   } else if (balloonLeft + balloon.DesiredSize.Width > canvasBorder.ActualWidth) {
     balloonLeft = position.X - balloon.DesiredSize.Width;
   }
   double balloonTop = position.Y - balloon.DesiredSize.Height - 5;
   if (balloonTop < 0) {
     balloonTop = position.Y + 17;
   }
   balloon.SetValue(Canvas.LeftProperty, balloonLeft);
   balloon.SetValue(Canvas.TopProperty, balloonTop);
   balloon.Text = slice.Title;
 }
Example #2
0
 private void AddSlices() {
   for (int i = slices.Count; i < values.Count; i++) {
     Slice slice = new Slice();
     slice.RenderTransform = new RotateTransform();
     slice.RenderTransformOrigin = new Point(0, 0);
     slices.Add(slice);
     slice.ManipulationStarted += new EventHandler<ManipulationStartedEventArgs>(OnSliceManipulationStarted);
     AddSliceToCanvas(slice);
   }
 }
Example #3
0
 private void AddSliceToCanvas(Slice slice) {
   if (canvas != null && !canvas.Children.Contains(slice)) {
     canvas.Children.Add(slice);
   }
 }
Example #4
0
 private void RemoveSliceFromCanvas(Slice slice) {
   if (canvas != null && canvas.Children.Contains(slice)) {
     canvas.Children.Remove(slice);
   }
 }