private void AddNameFormation(FormationInfo formation, TrackToShow trackToShow) { var annotationText = formation.FormationName.Length > 20 ? formation.FormationName.Substring(0, 20) : formation.FormationName; var textAnnotation = new CustomAnnotation { Content = annotationText, X1 = 0, X2 = 1, Y1 = double.Parse(formation.Depth.ToString()), Y2 = double.Parse(formation.Depth.ToString()), FontFamily = new FontFamily("Arial"), FontSize = 12, Height = 30, HorizontalAlignment = HorizontalAlignment.Right, HorizontalContentAlignment = HorizontalAlignment.Right, Padding = new Thickness(0, -20, 25, 0), CoordinateMode = AnnotationCoordinateMode.RelativeX, Tag = "Formation" }; textAnnotation.XAxisId = "Formation"; Binding binding = new Binding("Width") { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = trackToShow.TrackObject }; textAnnotation.SetBinding(CustomAnnotation.WidthProperty, binding); AddFTNameBinding(textAnnotation); trackToShow.Annotations.Add(textAnnotation); }
private void AddFTNameBinding(CustomAnnotation customAnnotation) { var binding = new MultiBinding(); binding.Converter = new FTVisibilityConverter(); binding.Bindings.Add(new Binding("IsFTNameVisible") { Source = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); binding.Bindings.Add(new Binding("IsFormationVisible") { Source = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); customAnnotation.SetBinding(CustomAnnotation.IsHiddenProperty, binding); }