static public void Initilize(WPFEngine engine) { engine.AddSimpleInstancer <Button>(); engine.AddAttributeLink <Button, string>("text", Button.ContentProperty); engine.AddAttributeFunction <Button>("action", (b, a) => b.Click += a.GetRoutedEventHandler()); engine.AddAttributeFunction <Button>("preview_mouse_left_button_down", (b, a) => b.PreviewMouseLeftButtonDown += a.GetMouseButtonEventHandler()); }
static public void Initilize(WPFEngine engine) { engine.AddGeneralModifier <FrameworkElement>((ex, e) => e.DataContext = ex.GetTargetInfo().GetTarget()); engine.AddAttributeValue <FrameworkElement, bool>("auto_focus", (f, v) => v.IfTrue(() => f.Focus())); engine.AddAttributeFunction <FrameworkElement>("bind_left_click", (f, a) => f.AddInputBinding(a, MouseAction.LeftClick)); engine.AddAttributeFunction <FrameworkElement>("bind_left_double_click", (f, a) => f.AddInputBinding(a, MouseAction.LeftDoubleClick)); }
static public void Initilize(WPFEngine engine) { engine.AddAttributeFunction <UIElement>("on_mouse_down", (e, f) => e.MouseDown += f.GetMouseButtonEventHandler()); engine.AddAttributeFunction <UIElement>("on_mouse_down_update", (e, f) => e.MouseMove += f.GetMouseEventHandler(z => z.IsPressed())); engine.AddAttributeFunction <UIElement>("on_mouse_move", (e, f) => e.MouseMove += f.GetMouseEventHandler()); engine.AddAttributeFunction <UIElement>("on_mouse_up", (e, f) => e.MouseUp += f.GetMouseButtonEventHandler()); engine.AddAttributeFunction <UIElement>("on_mouse_up_update", (e, f) => e.MouseMove += f.GetMouseEventHandler(z => z.IsPressed() == false)); }
static public void Initilize(WPFEngine engine) { engine.AddAttributeValue <FrameworkElement, ContextMenu>("context_menu", (f, e) => { f.ContextMenu = e; f.InvalidateVisual(); }); engine.AddSimpleInstancer <ContextMenu>(); engine.AddSimpleInstancer <Menu>(); engine.AddSimpleInstancer <MenuItem>(); engine.AddAttributeFunction <MenuItem>("command", (m, a) => m.Command = a.GetCommand()); engine.AddAttributeFunction <MenuItem>("action", (m, a) => m.Click += a.GetRoutedEventHandler()); engine.AddSimpleInstancer <Separator>(); }
static public void Initilize(WPFEngine engine) { engine.AddSimpleInstancer <DragHandler_Internal_Value>("DragHandler"); engine.AddAttributeLink <DragHandler_Internal_Value, object>("value", (h, v) => h.SetValue(v), h => h.GetValue(), h => true); engine.AddAttributeLink <DragHandler, DragDropEffects>("drag_drop_effects", (h, e) => h.SetDragDropEffects(e), e => e.GetDragDropEffects(), h => true); engine.AddAttributeLink <UIElement, DragHandler>("drag_handler", (e, h) => e.SetDragHandler(h), e => e.GetDragHandler()); engine.AddSimpleInstancer <DropHandler_Internal_FunctionSyncro>("DropHandler"); engine.AddAttributeFunction <DropHandler_Internal_FunctionSyncro>("on_enter", (h, f) => h.SetOnEnter(f)); engine.AddAttributeFunction <DropHandler_Internal_FunctionSyncro>("on_over", (h, f) => h.SetOnOver(f)); engine.AddAttributeFunction <DropHandler_Internal_FunctionSyncro>("on_leave", (h, f) => h.SetOnLeave(f)); engine.AddAttributeFunction <DropHandler_Internal_FunctionSyncro>("on_drop", (h, f) => h.SetOnDrop(f)); engine.AddAttributeChildren <UIElement, DropHandler>("drop_handlers", e => e.ClearDropHandlers(), (e, h) => e.AddDropHandler(h)); }
static public void Initilize(WPFEngine engine) { engine.AddAttributeChildren <UIElement>("input_bindings", e => e.InputBindings); engine.AddSimpleInstancer("InputBinding", () => new InputBinding(EmptyCommand.INSTANCE, EmptyInputGesture.INSTANCE)); engine.AddAttributeFunction <InputBinding>("action", (b, a) => b.Command = a.GetCommand()); engine.AddAttributeLink <InputBinding>("gesture", "Gesture"); engine.AddSimpleConstructor <MouseGesture, string, string>("MouseGesture", (a, m) => new MouseGesture(a.ConvertEX <MouseAction>(), m.ConvertEX <ModifierKeys>()) ); engine.AddSimpleConstructor <KeyGesture, string, string>("KeyGesture", (k, m) => new KeyGesture(k.ConvertEX <Key>(), m.ConvertEX <ModifierKeys>()) ); }
static public void Initilize(WPFEngine engine) { engine.AddSimpleInstancer <Window>(); engine.AddAttributeFunction <Window>("on_close", (w, s) => w.Closed += s.GetEventHandler()); }