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.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.AddAttributeValue<Decorator, UIElement>("child", (d, e) => d.Child = e); engine.AddChildren<Decorator, UIElement>(d => d.Child = null, (d, e) => d.Child = e); }