public Accessor(PerspexObject instance, PerspexProperty property, Action<object> changed)
            {
                Contract.Requires<ArgumentNullException>(instance != null);
                Contract.Requires<ArgumentNullException>(property != null);

                _instance = instance;
                _property = property;
                _subscription = instance.GetObservable(property).Skip(1).Subscribe(changed);
            }
Esempio n. 2
0
            public Accessor(PerspexObject instance, PerspexProperty property, Action <object> changed)
            {
                Contract.Requires <ArgumentNullException>(instance != null);
                Contract.Requires <ArgumentNullException>(property != null);

                _instance     = instance;
                _property     = property;
                _subscription = instance.GetObservable(property).Skip(1).Subscribe(changed);
            }
Esempio n. 3
0
        private void HandleXamlBindingDefinition(XamlBindingDefinition xamlBindingDefinition)
        {
            PerspexObject subjectObject = xamlBindingDefinition.Target;

            _propertyBinder.Create(xamlBindingDefinition);

            var observableForDataContext = subjectObject.GetObservable(Control.DataContextProperty);

            observableForDataContext.Where(o => o != null).Subscribe(_ => BindToDataContextWhenItsSet(xamlBindingDefinition));
        }
Esempio n. 4
0
        public PropertyDetails(PerspexObject o, PerspexProperty property)
        {
            Name = property.IsAttached ?
                   $"[{property.OwnerType.Name}.{property.Name}]" :
                   property.Name;
            IsAttached = property.IsAttached;

            // TODO: Unsubscribe when view model is deactivated.
            o.GetObservable(property).Subscribe(x =>
            {
                var diagnostic = o.GetDiagnostic(property);
                Value          = diagnostic.Value ?? "(null)";
                Priority       = (diagnostic.Priority != BindingPriority.Unset) ?
                                 diagnostic.Priority.ToString() :
                                 diagnostic.Property.Inherits ? "Inherited" : "Unset";
                Diagnostic = diagnostic.Diagnostic;
            });
        }
Esempio n. 5
0
        public PropertyDetails(PerspexObject o, PerspexProperty property)
        {
            Name = property.IsAttached ?
                $"[{property.OwnerType.Name}.{property.Name}]" :
                property.Name;
            IsAttached = property.IsAttached;

            // TODO: Unsubscribe when view model is deactivated.
            o.GetObservable(property).Subscribe(x =>
            {
                var diagnostic = o.GetDiagnostic(property);
                Value = diagnostic.Value ?? "(null)";
                Priority = (diagnostic.Priority != BindingPriority.Unset) ?
                    diagnostic.Priority.ToString() :
                    diagnostic.Property.Inherits ? "Inherited" : "Unset";
                Diagnostic = diagnostic.Diagnostic;
            });
        }