/// <summary>
 ///     Add a ThumbstickDirection binding that can be checked for state (Pressed, Released, Active)
 /// </summary>
 public static bool AddBinding(this InputManager inputManager, string bindingName,
                               ThumbstickDirection thumbstickDirection,
                               Thumbstick thumbstick, params InputBinding[] modifiers)
 {
     DefaultBinding inputBinding = new ThumbstickDirectionBinding(thumbstickDirection, thumbstick, modifiers);
     return inputManager.AddBinding(bindingName, inputBinding);
 }
        public static void AddBindings(this IMvxBindingContextOwner view, object target, IEnumerable<IMvxUpdateableBinding> bindings, object clearKey = null)
        {
            if (bindings == null)
                return;

            foreach (var binding in bindings)
                view.AddBinding(target, binding, clearKey);
        }
        public static void AddBindings(this IMvxBindingContextOwner view, IEnumerable<IMvxUpdateableBinding> bindings)
        {
            if (bindings == null)
                return;

            foreach (var binding in bindings)
                view.AddBinding(binding);
        }
        public static void BindLanguage(this IMvxBindingContextOwner owner
                                        , object target
                                        , string targetPropertyName
                                        , string sourceKey
                                        , string sourcePropertyName = null
                                        , string fallbackValue = null
                                        , string converterName = null)
        {
            converterName = converterName ?? LanguageParser.DefaultConverterName;
            sourcePropertyName = sourcePropertyName ?? LanguageParser.DefaultTextSourceName;

            var converter = ValueConverterLookup.Find(converterName);

            var bindingDescription = new MvxBindingDescription
                {
                    TargetName = targetPropertyName,
                    SourcePropertyPath = sourcePropertyName,
                    Converter = converter,
                    ConverterParameter = sourceKey,
                    FallbackValue = fallbackValue,
                    Mode = MvxBindingMode.OneWay
                };
            owner.AddBinding(target, bindingDescription);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the binding between target and source.
 /// </summary>
 public static IBindingExpression AddBinding(this IBindingScope scope, object target, object source, Binding binding)
 {
     return scope.AddBinding(target, binding.PropertyName, source, binding);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the binding between target and source.
 /// </summary>
 public static IBindingExpression AddBinding(this IBindingScope scope, object target, string targetPropertyName, object source, string sourcePropertyName)
 {
     return scope.AddBinding(target, targetPropertyName, source, new Binding(sourcePropertyName));
 }
 /// <summary>
 ///     Add a key binding that can be checked for state (Pressed, Released, Active)
 /// </summary>
 public static bool AddBinding(this InputManager inputManager, string bindingName, Keys key,
                               params InputBinding[] modifiers)
 {
     DefaultBinding inputBinding = new KeyBinding(key, modifiers);
     return inputManager.AddBinding(bindingName, inputBinding);
 }
 /// <summary>
 ///     Add a Button binding that can be checked for state (Pressed, Released, Active)
 /// </summary>
 public static bool AddBinding(this InputManager inputManager, string bindingName,
                               Buttons button, params InputBinding[] modifiers)
 {
     DefaultBinding inputBinding = new ButtonBinding(button, modifiers);
     return inputManager.AddBinding(bindingName, inputBinding);
 }
 /// <summary>
 ///     Add a Trigger binding that can be checked for state (Pressed, Released, Active)
 /// </summary>
 public static bool AddBinding(this InputManager inputManager, string bindingName,
                               Trigger trigger, params InputBinding[] modifiers)
 {
     DefaultBinding inputBinding = new TriggerBinding(trigger, modifiers);
     return inputManager.AddBinding(bindingName, inputBinding);
 }
 public static void BindTo(this BindableCommand command, ToolStripItem tsItem)
 {
     var newBinding = new ToolStripItemCommandBinding(command, tsItem);
     command.AddBinding(newBinding);
 }
 public static void BindTo(this BindableCommand command, Control control)
 {
     var newBinding = new ControlCommandBinding(command, control);
     command.AddBinding(newBinding);
 }