Exemplo n.º 1
0
 public static T SetEnvironment <T>(this T contextualObject, string key, object value, bool cascades = true, ControlState state = ControlState.Default)
     where T : ContextualObject
 {
     key = ContextualObject.GetControlStateKey(state, key);
     if (!contextualObject.SetValue(key, value, cascades))
     {
         return(contextualObject);
     }
     ThreadHelper.RunOnMainThread(() => {
         contextualObject.ContextPropertyChanged(key, value, cascades);
     });
     return(contextualObject);
 }
Exemplo n.º 2
0
        public static T SetEnvironment <T>(this T contextualObject, Type type, string key, object value, bool cascades = true, ControlState state = ControlState.Default)
            where T : ContextualObject
        {
            key = ContextualObject.GetControlStateKey(state, key);
            var typedKey = ContextualObject.GetTypedKey(type, key);

            contextualObject.SetValue(typedKey, value, cascades);
            //TODO: Verify this is needed
            ThreadHelper.RunOnMainThread(() => {
                contextualObject.ContextPropertyChanged(typedKey, value, cascades);
            });
            return(contextualObject);
        }
Exemplo n.º 3
0
 public static T SetEnvironment <T, TValue>(this T view, string key, Binding <TValue> binding, bool cascades = true, ControlState state = ControlState.Default)
     where T : View
 {
     binding.BindToProperty(view, key);
     key = ContextualObject.GetControlStateKey(state, key);
     if (!view.SetValue(key, binding, cascades))
     {
         return(view);
     }
     ThreadHelper.RunOnMainThread(() => {
         view.ContextPropertyChanged(key, binding, cascades);
     });
     return(view);
 }
Exemplo n.º 4
0
        public static T SetEnvironment <T, TValue>(this T view, Type type, string key, Binding <TValue> binding, bool cascades = true, ControlState state = ControlState.Default)
            where T : View
        {
            binding.BindToProperty(view, key);
            key = ContextualObject.GetControlStateKey(state, key);
            var typedKey = ContextualObject.GetTypedKey(type, key);

            view.SetValue(typedKey, binding, cascades);
            //TODO: Verify this is needed
            ThreadHelper.RunOnMainThread(() => {
                view.ContextPropertyChanged(typedKey, binding, cascades);
            });
            return(view);
        }
Exemplo n.º 5
0
 public static T GetEnvironment <T>(this View view, Type type, string key, ControlState state, bool cascades = true)
 {
     key = ContextualObject.GetControlStateKey(state, key);
     return(view.GetEnvironment <T>(type, key, cascades));
 }