public AtomCoachMarkImage() { Content = new AtomImage(); Content.SetBinding(AtomImage.SourceProperty, new Binding { Path = "Source", Source = this }); }
/// <summary> /// /// </summary> public AtomDatePickerTemplate() { this.ColumnSpacing = 5; this.ColumnDefinitions.Add(new ColumnDefinition { }); this.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); this.Children.Add(new ContentPresenter()); AtomImage clearButton = new AtomImage { Source = AtomStockImages.DeleteImageUrl }; clearButton.GestureRecognizers.Add(new TapGestureRecognizer { Command = new AtomCommand(() => { var a = this.Parent as AtomDatePicker; a.Value = null; return(Task.CompletedTask); }) }); SetColumn(clearButton, 1); Children.Add(clearButton); clearButton.WidthRequest = 25; clearButton.HeightRequest = 25; clearButton.SetBinding( Image.IsVisibleProperty, new TemplateBinding( nameof(AtomDatePicker.Value), BindingMode.OneWay, NotNullVisibilityConverter.Instance )); }
/// <summary> /// Since Xamarin does not remove default transformations, we need to simply remove and create new AtomZoomView /// with new AtomImage /// </summary> private void RecreateImage() { this.IsClippedToBounds = false; croppedImage.PropertyChanged -= OnImagePropertyChanged; zoomView.PropertyChanged -= OnZoomViewPropertyChanged; cropContainer.Children.Remove(zoomView); //Debug.WriteLine($"zoomView is reset correctly"); zoomView = new AtomZoomView(); croppedImage = new AtomImage(); croppedImage.PropertyChanged += OnImagePropertyChanged; zoomView.PropertyChanged += OnZoomViewPropertyChanged; zoomView.Content = croppedImage; cropContainer.Children.Add(zoomView); zoomView.SetBinding(AtomZoomView.IsEnabledProperty, new Binding() { Path = nameof(CanUndo), Source = this, Converter = NegateBooleanConverter.Instance }); }
public AtomPopupPageTemplate() { Padding = new Thickness(5); Grid innerGrid = new Grid(); innerGrid.Padding = new Thickness(10); innerGrid.Effects.Add(new AtomRoundBorderEffect { BackgroundColor = Color.White, CornerRadius = 5 }); RowDefinitions.Add(new RowDefinition { }); RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(5, GridUnitType.Star) }); BoxView bv = new BoxView(); bv.BackgroundColor = Color.Transparent; bv.MinimumHeightRequest = 30; Children.Add(bv); AtomImage cancelImage = new AtomImage { Source = AtomStockImages.DeleteImageUrl, WidthRequest = 30, HeightRequest = 30 }; cancelImage.GestureRecognizers.Add(new TapGestureRecognizer { Command = new AtomCommand(async() => { try { await DependencyService.Get <IAppNavigator>().PopModalAsync(true); } catch (Exception ex) { UIAtomsApplication.Instance?.LogException?.Invoke(ex); System.Diagnostics.Debug.Fail(ex.Message, ex.ToString()); } }) }); Label title = new Label { VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, Margin = new Thickness(5) }; title.SetBinding(Label.TextProperty, new TemplateBinding { Path = nameof(AtomPopupPage.Title) }); Grid.SetColumn(cancelImage, 1); innerGrid.ColumnDefinitions.Add(new ColumnDefinition { }); innerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); innerGrid.AddRowItems(GridLength.Auto, title, cancelImage); innerGrid.AddRowItem(new ContentPresenter { }); Grid.SetRow(innerGrid, 1); Children.Add(innerGrid); }