Exemple #1
0
        private IDisposable AttachFlyoutCommand(string targetButtonName, Action <DatePickerFlyout> action)
        {
            if (_presenter.FindName(targetButtonName) is Button button)
            {
                if (button.Command == null)
                {
                    var self = WeakReferencePool.RentSelfWeakReference(this);
                    button.Command = new DelegateCommand(() => (self.Target as DatePickerFlyout)?.Apply(action));

                    return(Disposable.Create(() =>
                    {
                        button.Command = null;
                        self.Dispose();
                    }));
                }
            }

            return(Disposable.Empty);
        }
Exemple #2
0
        private void UpdateTextBoxView()
        {
            if (_textBoxView == null && _contentElement != null)
            {
                _textBoxView = _contentElement.GetChildren().FirstOrDefault() as TextBoxView;

                if (_textBoxView == null)
                {
                    _textBoxView = new TextBoxView(this);

                    _contentElement.Content = _textBoxView;
                    _textBoxView.SetTextNative(Text);

                    _editableFactory = _editableFactory ?? new Factory(WeakReferencePool.RentSelfWeakReference(this));
                    _textBoxView.SetEditableFactory(_editableFactory);
                }

                SetupTextBoxView();
            }
        }
Exemple #3
0
 public MyProvider()
 {
     WeakReference = WeakReferencePool.RentSelfWeakReference(this);
 }