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); }
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(); } }
public MyProvider() { WeakReference = WeakReferencePool.RentSelfWeakReference(this); }