示例#1
0
 void SetSelectionLengthFromRenderer(int selectionLength)
 {
     try
     {
         _nativeSelectionIsUpdating = true;
         ElementController?.SetValueFromRenderer(Entry.SelectionLengthProperty, selectionLength);
     }
     catch (System.Exception ex)
     {
         Application.Current?.FindMauiContext()?.CreateLogger <EntryRenderer>()?.LogWarning(ex, "Failed to set SelectionLength from renderer");
     }
     finally
     {
         _nativeSelectionIsUpdating = false;
     }
 }
示例#2
0
 void SetCursorPositionFromRenderer(int start)
 {
     try
     {
         _nativeSelectionIsUpdating = true;
         ElementController?.SetValueFromRenderer(Entry.CursorPositionProperty, start);
     }
     catch (System.Exception ex)
     {
         Internals.Log.Warning("Entry", $"Failed to set CursorPosition from renderer: {ex}");
     }
     finally
     {
         _nativeSelectionIsUpdating = false;
     }
 }
示例#3
0
 void SetSelectionLengthFromRenderer(int selectionLength)
 {
     try
     {
         _nativeSelectionIsUpdating = true;
         ElementController?.SetValueFromRenderer(Entry.SelectionLengthProperty, selectionLength);
     }
     catch (System.Exception ex)
     {
         Internals.Log.Warning("Entry", $"Failed to set SelectionLength from renderer: {ex}");
     }
     finally
     {
         _nativeSelectionIsUpdating = false;
     }
 }
示例#4
0
        private void OnLoadFinished(object o, EventArgs args)
        {
            if (Control == null)
            {
                return;
            }

            _ignoreSourceChanges = true;
            ElementController?.SetValueFromRenderer(WebView.SourceProperty,
                                                    new UrlWebViewSource {
                Url = Control.Uri
            });
            _ignoreSourceChanges = false;

            _lastEvent = _lastBackForwardEvent;
            WebViewController?.SendNavigated(new WebNavigatedEventArgs(
                                                 _lastEvent,
                                                 Element?.Source,
                                                 Control.Uri,
                                                 WebNavigationResult.Success));

            UpdateCanGoBackForward();
        }
示例#5
0
        private void OnTimeChanged(object sender, EventArgs e)
        {
            var currentTime = (DateTime.Today + Control.CurrentTime);

            ElementController?.SetValueFromRenderer(TimePicker.TimeProperty, currentTime);
        }
示例#6
0
 private void OnChanged(object sender, System.EventArgs e)
 {
     ElementController?.SetValueFromRenderer(Picker.SelectedIndexProperty, Control.Active);
 }
示例#7
0
 private void OnFocused(object o, FocusedArgs args)
 {
     ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
 }
示例#8
0
 private void TextViewFocusedOut(object o, FocusOutEventArgs args)
 {
     ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
     EditorController.SendCompleted();
 }
示例#9
0
 protected virtual void OnLostFocus(object sender, RoutedEventArgs args)
 {
     ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
 }
示例#10
0
 void OnStarted(object sender, EventArgs eventArgs)
 {
     ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
 }
示例#11
0
 void HandleChanged(object sender, EventArgs e)
 {
     ElementController.SetValueFromRenderer(Editor.TextProperty, TextView.Text);
 }
示例#12
0
 private void OnEditingDone(object sender, System.EventArgs e)
 {
     ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
     EntryController?.SendCompleted();
 }
示例#13
0
 private void OnChanged(object sender, System.EventArgs e)
 {
     ElementController.SetValueFromRenderer(Entry.TextProperty, Control.Entry.Text);
 }
示例#14
0
 private void OnCheckButtonToggled(object sender, EventArgs e)
 {
     ElementController.SetValueFromRenderer(Switch.IsToggledProperty, Control.Active);
 }
示例#15
0
 private void OnValueChanged(object sender, EventArgs e)
 {
     ElementController.SetValueFromRenderer(Stepper.ValueProperty, Control.Value);
 }
示例#16
0
 private void OnDateChanged(object sender, EventArgs e)
 {
     ElementController?.SetValueFromRenderer(DatePicker.DateProperty, Control.CurrentDate.Date);
 }
示例#17
0
 private void SearchFocusOutEvent(object o, Gtk.FocusOutEventArgs args)
 {
     ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
 }
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();

            bool layoutFlyout  = false;
            bool layoutDetails = false;

            if (Forms.IsiOS13OrNewer)
            {
                layoutFlyout  = _flyoutController?.View?.Superview != null;
                layoutDetails = _detailController?.View?.Superview != null;
            }
            else if (View.Subviews.Length < 2)
            {
                return;
            }
            else
            {
                layoutFlyout  = true;
                layoutDetails = true;
            }

            if (layoutFlyout)
            {
                var flyoutBounds = _flyoutController.View.Frame;

                if (Forms.IsiOS13OrNewer)
                {
                    _flyoutWidth = flyoutBounds.Width;
                }
                else
                {
                    _flyoutWidth = (nfloat)Math.Max(_flyoutWidth, flyoutBounds.Width);
                }

                if (!flyoutBounds.IsEmpty)
                {
                    FlyoutPage.FlyoutBounds = new Rectangle(0, 0, _flyoutWidth, flyoutBounds.Height);
                }
            }

            if (layoutDetails)
            {
                var detailsBounds = _detailController.View.Frame;
                if (!detailsBounds.IsEmpty)
                {
                    FlyoutPage.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height);
                }
            }

            if (_previousViewDidLayoutSize == CGSize.Empty)
            {
                _previousViewDidLayoutSize = View.Bounds.Size;
            }

            // Is this being called from a rotation
            if (_previousViewDidLayoutSize != View.Bounds.Size)
            {
                _previousViewDidLayoutSize = View.Bounds.Size;

                // make sure IsPresented matches state of Flyout View
                if (FlyoutPage.CanChangeIsPresented && FlyoutPage.IsPresented != IsFlyoutVisible)
                {
                    ElementController.SetValueFromRenderer(Microsoft.Maui.Controls.FlyoutPage.IsPresentedProperty, IsFlyoutVisible);
                }
            }

            if (_previousDisplayMode != PreferredDisplayMode)
            {
                _previousDisplayMode = PreferredDisplayMode;

                // make sure IsPresented matches state of Flyout View
                if (FlyoutPage.CanChangeIsPresented && FlyoutPage.IsPresented != IsFlyoutVisible)
                {
                    ElementController.SetValueFromRenderer(Microsoft.Maui.Controls.FlyoutPage.IsPresentedProperty, IsFlyoutVisible);
                }
            }
        }
示例#19
0
 private void OnIsPresentedChanged(object sender, EventArgs e)
 {
     ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, Widget.IsPresented);
 }
示例#20
0
 private void LostFocus(object sender, EventArgs e)
 {
     ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
 }