Beispiel #1
0
        void OnTextBlockFocused(object?sender, EventArgs e)
        {
            if (VirtualView == null || PlatformView == null || NativeParent == null)
            {
                return;
            }

            // For EFL Entry, the event will occur even if it is currently disabled.
            // If the problem is resolved, no conditional statement is required.
            if (VirtualView.IsEnabled)
            {
                int i = 0;
                _dialog = new Dialog(NativeParent)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    Title      = VirtualView.Title,
                };
                _dialog.Dismissed         += OnDialogDismissed;
                _dialog.BackButtonPressed += (object?senders, EventArgs es) =>
                {
                    _dialog.Dismiss();
                };

                _list = new List(_dialog);
                foreach (var s in VirtualView.GetItemsAsArray())
                {
                    ListItem item = _list.Append(s);
                    _itemToItemNumber[item] = i;
                    i++;
                }
                _list.ItemSelected += OnItemSelected;
                _dialog.Content     = _list;

                // You need to call Show() after ui thread occupation because of EFL problem.
                // Otherwise, the content of the popup will not receive focus.
                EcoreMainloop.Post(() =>
                {
                    _dialog.Show();
                    _list.Show();
                });
            }
        }
        void OnTextBlockFocused(object?sender, EventArgs e)
        {
            if (VirtualView == null || PlatformView == null || _lazyDialog == null)
            {
                return;
            }

            // For EFL Entry, the event will occur even if it is currently disabled.
            // If the problem is resolved, no conditional statement is required.
            if (VirtualView.IsEnabled)
            {
                var dialog = _lazyDialog.Value;
                dialog.DateTime -= dialog.DateTime.TimeOfDay;
                dialog.DateTime += VirtualView.Time;

                // You need to call Show() after ui thread occupation because of EFL problem.
                // Otherwise, the content of the popup will not receive focus.
                EcoreMainloop.Post(() => dialog.Show());
            }
        }
        void UpdateContentSize()
        {
            _ = Canvas ?? throw new InvalidOperationException($"{nameof(Canvas)} cannot be null");

            if (VirtualView == null || VirtualView.PresentedContent == null)
            {
                return;
            }

            Canvas.MinimumWidth  = (VirtualView.PresentedContent.Margin.HorizontalThickness + VirtualView.PresentedContent.Frame.Width + VirtualView.Padding.HorizontalThickness).ToScaledPixel();
            Canvas.MinimumHeight = (VirtualView.PresentedContent.Margin.VerticalThickness + VirtualView.PresentedContent.Frame.Height + VirtualView.Padding.VerticalThickness).ToScaledPixel();

            // elm-scroller updates the CurrentRegion after render
            EcoreMainloop.Post(() =>
            {
                if (PlatformView != null)
                {
                    OnScrolled(PlatformView, EventArgs.Empty);
                }
            });
        }