/// <summary> /// Creates a new view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The view instance.</returns> protected override ScrollView CreateViewInstance(ThemedReactContext reactContext) { var scrollViewerData = new ScrollViewerData(); var scrollViewer = new ScrollView { HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Focusable = false, }; _scrollViewerData.Add(scrollViewer, scrollViewerData); return(scrollViewer); }
/// <summary> /// Creates the view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The view instance.</returns> protected override RichTextBlock CreateViewInstance(ThemedReactContext reactContext) { var richTextBlock = new RichTextBlock { IsTextSelectionEnabled = false, TextAlignment = TextAlignment.DetectFromContent, TextTrimming = TextTrimming.CharacterEllipsis, TextWrapping = TextWrapping.Wrap, }; richTextBlock.Blocks.Add(new Paragraph()); richTextBlock.SetReactCompoundView(s_compoundView); return(richTextBlock); }
/// <summary> /// Called when view is detached from view hierarchy and allows for /// additional cleanup. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view.</param> public override void OnDropViewInstance(ThemedReactContext reactContext, Border view) { base.OnDropViewInstance(reactContext, view); var tag = view.GetTag(); var disposable = default(SerialDisposable); if (_disposables.TryGetValue(tag, out disposable)) { disposable.Dispose(); _disposables.Remove(tag); } _imageSources.Remove(tag); }
/// <summary> /// Install custom event emitters on the given view. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view instance.</param> protected override void AddEventEmitters(ThemedReactContext reactContext, Border view) { var imageBrush = (ImageBrush)view.Background; var imageFailedHandler = new ExceptionRoutedEventHandler( (sender, args) => OnImageFailed(view, args)); imageBrush.ImageFailed += imageFailedHandler; var imageOpenedHandler = new RoutedEventHandler( (sender, args) => OnImageOpened(view, args)); imageBrush.ImageOpened += imageOpenedHandler; _imageFailedHandlers.Add(view, imageFailedHandler); }
/// <summary> /// Creates a new view instance of type <see cref="activityIndicator"/>. /// </summary> /// <param name="reactContext">The react context.</param> /// <returns>The view instance.</returns> protected override ProgressBar CreateViewInstance(ThemedReactContext reactContext) { Log.Info(ReactConstants.Tag, "[Views] ReactActivityIndicatorManager::CreateViewInstance BGN "); // create view component & set basic prop ProgressBar activityIndicator = new ProgressBar(ReactProgram.RctWindow) { Style = "process", }; activityIndicator.PlayPulse(); activityIndicator.Show(); return(activityIndicator); }
/// <summary> /// Creates a new view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The view instance.</returns> protected override Scroller CreateViewInstance(ThemedReactContext reactContext) { //var scrollViewerData = new ScrollViewerData(); var scrollViewer = new Scroller(ReactProgram.RctWindow) { //Style = "white", }; //scrollViewer.SetPageSize(1.0, 1.0); //scrollViewer.ScrollTo(scrollViewer.HorizontalPageIndex > 0 ? scrollViewer.HorizontalPageIndex - 1 : 0, scrollViewer.VerticalPageIndex, true); //_scrollViewerData.Add(scrollViewer, scrollViewerData); scrollViewer.Show(); return(scrollViewer); }
/* * /// <summary> * /// The border radius of the <see cref="ReactRootView"/>. * /// </summary> * /// <param name="view">The image view instance.</param> * /// <param name="radius">The border radius value.</param> * [ReactProp("borderRadius")] * public void SetBorderRadius(Image view, double radius) * { * //view.CornerRadius = new CornerRadius(radius); * } * * /// <summary> * /// Sets the border thickness of the image view. * /// </summary> * /// <param name="view">The image view instance.</param> * /// <param name="index">The property index.</param> * /// <param name="width">The border width in pixels.</param> * [ReactPropGroup( * ViewProps.BorderWidth, * ViewProps.BorderLeftWidth, * ViewProps.BorderRightWidth, * ViewProps.BorderTopWidth, * ViewProps.BorderBottomWidth, * DefaultDouble = double.NaN)] * public void SetBorderWidth(Image view, int index, double width) * { * // TODO: * } * * /// <summary> * /// Set the border color of the image view. * /// </summary> * /// <param name="view">The image view instance.</param> * /// <param name="color">The masked color value.</param> * [ReactProp("borderColor", CustomType = "Color")] * public void SetBorderColor(Image view, uint? color) * { * } */ /// <summary> /// Creates the image view instance. /// </summary> /// <param name="reactContext">The react context.</param> /// <returns>The image view instance.</returns> protected override Image CreateViewInstance(ThemedReactContext reactContext) { Log.Info(ReactConstants.Tag, "## Enter CreateViewInstance of Image ##"); var image = new Image(ReactProgram.RctWindow) { IsFixedAspect = true, PrescaleSize = 1 }; image.Show(); Log.Info(ReactConstants.Tag, "## Exit CreateViewInstance of Image ##"); return(image); }
/// <summary> /// Creates a new view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The view instance.</returns> protected override ScrollViewer CreateViewInstance(ThemedReactContext reactContext) { var scrollViewerData = new ScrollViewerData(); var scrollViewer = new ScrollViewer { HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden, HorizontalScrollMode = ScrollMode.Disabled, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, VerticalScrollMode = ScrollMode.Auto, }; _scrollViewerData.Add(scrollViewer, scrollViewerData); return(scrollViewer); }
/// <summary> /// Creates a new view instance of type <see cref="ProgressBar"/>. /// </summary> /// <param name="reactContext">The react context.</param> /// <returns>The view instance.</returns> protected override ProgressBar CreateViewInstance(ThemedReactContext reactContext) { Log.Info(ReactConstants.Tag, "[Views] ReactProgressBarManager::CreateViewInstance BGN "); // create view component & set basic prop ProgressBar pb = new ProgressBar(ReactProgram.RctWindow) { //Style = "default", //Color = Color.Orange, //SpanSize = 400, //Value = 0.5 }; pb.Show(); return(pb); }
/// <summary> /// Called when view is detached from view hierarchy and allows for /// additional cleanup by the <see cref="ReactScrollViewManager"/>. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view.</param> public override void OnDropViewInstance(ThemedReactContext reactContext, ScrollView view) { base.OnDropViewInstance(reactContext, view); _scrollViewerData.Remove(view); var hashCode = view.GetHashCode(); if (_scollViewCancelMap.ContainsKey(hashCode)) { _scollViewCancelMap[hashCode].Cancel(); _scollViewCancelMap.Remove(hashCode); } view.ScrollChanged -= OnViewChanging; view.ManipulationStarted -= OnDirectManipulationStarted; view.ManipulationCompleted -= OnDirectManipulationCompleted; }
/// <summary> /// Creates a new view instance of type <see cref="Button"/>. /// </summary> /// <param name="reactContext">The react context.</param> /// <returns>The view instance.</returns> protected override ReactTextBox CreateViewInstance(ThemedReactContext reactContext) { Log.Info(ReactConstants.Tag, "[Views] Enter Create ReactTextBox instance "); ReactTextBox txtInput = new ReactTextBox(ReactProgram.RctWindow) { //Color = Color.Green, //Placeholder = "Tell me your name ...", //PlaceholderColor = Color.Olive, //BackgroundColor = Color.Orange, //FontAttributes = FontAttributes.Bold | FontAttributes.Italic }; txtInput.Show(); Log.Info(ReactConstants.Tag, "[Views] Exit Create ReactTextBox instance "); return(txtInput); }
/// <summary> /// Creates a new view instance of type <see cref="borderImage"/>. /// </summary> /// <param name="reactContext">The react context.</param> /// <returns>The view instance.</returns> protected override Image CreateViewInstance(ThemedReactContext reactContext) { Log.Info(ReactConstants.Tag, "[Views] ReactBorderDrawingManager::CreateViewInstance BGN "); // create view component & set basic prop Image borderImage = new Image(ReactProgram.RctWindow) { Color = Color.Red, }; borderImage.Resize(1920, 1080); borderImage.Move(0, 0); borderImage.Show(); return(borderImage); }
/// <summary> /// Creates the image view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The image view instance.</returns> protected override Border CreateViewInstance(ThemedReactContext reactContext) { var border = new Border { Background = new ImageBrush { Stretch = Stretch.UniformToFill }, }; // Using a Border instead of a native Image has its advantages (round corner support, etc.), but // we have to take into account the automatic flipping that happens in RTL mode. We use a transform // to negate that flipping. // Control starts as LeftToRight in isolation, but we hook to the FlowDirection property change to get // the correct value when attached to component tree and the further changes. border.RegisterPropertyChangedCallback(FrameworkElement.FlowDirectionProperty, FlowDirectionChanged); return(border); }
/// <summary> /// Creates a new view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The view instance.</returns> protected override ScrollViewer CreateViewInstance(ThemedReactContext reactContext) { var scrollViewerData = new ScrollViewerData(); var scrollViewer = new ScrollViewer { HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden, HorizontalScrollMode = ScrollMode.Disabled, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, VerticalScrollMode = ScrollMode.Auto, // The default tab index keeps the ScrollViewer (and its children) outside the normal flow of tabIndex==0 controls. // We force a better default, at least until we start supporting TabIndex/IsTabStop properties on RCTScrollView. TabIndex = 0, }; _scrollViewerData.Add(scrollViewer, scrollViewerData); return(scrollViewer); }
/// <summary> /// Called when view is detached from view hierarchy and allows for /// additional cleanup. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view.</param> public override void OnDropViewInstance(ThemedReactContext reactContext, Border view) { var imageBrush = (ImageBrush)view.Background; var imageFailedHandler = default(ExceptionRoutedEventHandler); if (_imageFailedHandlers.TryGetValue(view, out imageFailedHandler)) { _imageFailedHandlers.Remove(view); imageBrush.ImageFailed -= imageFailedHandler; } var imageOpenedHandler = default(RoutedEventHandler); if (_imageOpenedHandlers.TryGetValue(view, out imageOpenedHandler)) { _imageOpenedHandlers.Remove(view); imageBrush.ImageOpened -= imageOpenedHandler; } }
/// <summary> /// Creates the image view instance. /// </summary> /// <param name="reactContext">The React context.</param> /// <returns>The image view instance.</returns> protected override Border CreateViewInstance(ThemedReactContext reactContext) { var border = new Border { Background = new ImageBrush { Stretch = Stretch.UniformToFill, }, }; // Using a Border instead of a native Image has its advantages (round corner support, etc.), but // we have to take into account the automatic flipping that happens in RTL mode. We use a transform // to negate that flipping. // NOTE: This WPF implementation doesn't support updating this on the fly if (I18NUtil.IsRightToLeft) { border.Background.RelativeTransform = _rtlScaleTransform.Value; } return(border); }
protected override AGInkCanvas CreateViewInstance(ThemedReactContext reactContext) { var canvas = new AGInkCanvas(); // Set supported inking device types. canvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Touch | Windows.UI.Core.CoreInputDeviceTypes.Pen; // Set initial ink stroke attributes. InkDrawingAttributes drawingAttributes = new InkDrawingAttributes(); drawingAttributes.Color = Windows.UI.Colors.Black; drawingAttributes.IgnorePressure = false; drawingAttributes.FitToCurve = true; canvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes); // Return canvas return(canvas); }
/// <summary> /// Returns the view instance for <see cref="Slider"/>. /// </summary> /// <param name="reactContext"></param> /// <returns></returns> protected override Windows.UI.Xaml.Controls.Slider CreateViewInstance(ThemedReactContext reactContext) { return(new Windows.UI.Xaml.Controls.Slider()); }
/// <summary> /// Subclasses can override this method to install custom event /// emitters on the given view. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view instance.</param> protected override void AddEventEmitters(ThemedReactContext reactContext, ComboBox view) { view.SelectionChanged += OnSelectionChanged; }
/// <summary> /// Subclasses can override this method to install custom event /// emitters on the given view. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view instance.</param> protected override void AddEventEmitters(ThemedReactContext reactContext, ToggleSwitch view) { base.AddEventEmitters(reactContext, view); view.Toggled += OnToggled; }
/// <summary> /// Called when view is detached from view hierarchy and allows for /// additional cleanup by the <see cref="ReactSwitchManager"/>. /// </summary> /// <param name="reactContext">The React context.</param> /// <param name="view">The view.</param> public override void OnDropViewInstance(ThemedReactContext reactContext, ToggleSwitch view) { base.OnDropViewInstance(reactContext, view); view.Toggled -= OnToggled; }
public override void OnDropViewInstance(ThemedReactContext reactContext, FlipView view) { base.OnDropViewInstance(reactContext, view); view.SelectionChanged -= OnSelectionChanged; }
protected override CaptureElement CreateViewInstance(ThemedReactContext reactContext) { return(new CaptureElement()); }
protected override FlipView CreateViewInstance(ThemedReactContext reactContext) { return(new FlipView()); }
protected override void AddEventEmitters(ThemedReactContext reactContext, FlipView view) { base.AddEventEmitters(reactContext, view); view.SelectionChanged += OnSelectionChanged; }
/// <summary> /// Returns the view instance for <see cref="PasswordBox"/>. /// </summary> /// <param name="reactContext">The themed React Context</param> /// <returns>A new initialized <see cref="PasswordBox"/></returns> protected override PasswordBox CreateViewInstance(ThemedReactContext reactContext) { return(new PasswordBox()); }
protected override Java.Lang.Object CreateViewInstance(ThemedReactContext p0) { return(RawCreateViewInstance(p0)); }
public override void OnDropViewInstance(ThemedReactContext reactContext, Button view) { view.Click -= Button_Click; }
protected override void AddEventEmitters(ThemedReactContext reactContext, Button view) { base.AddEventEmitters(reactContext, view); view.Click += Button_Click; }
protected override Button CreateViewInstance(ThemedReactContext reactContext) { return(new Button()); }