示例#1
0
        internal InputManager(
            NoesisViewWrapper noesisViewWrapper,
            NoesisConfig config)
        {
            this.noesisViewWrapper = noesisViewWrapper;
            var view            = noesisViewWrapper.GetView();
            var controlTreeRoot = view.Content;

            this.keyboard = new Keyboard(
                view,
                controlTreeRoot.Keyboard,
                config);

            // Find control tree root.
            // It's super important to use global UI root to process visual tree hit testing:
            // controlTreeRoot root is not the UI root and popup visuals are created in the UI root.
            var rootVisual = (Visual)controlTreeRoot;

            while (VisualTreeHelper.GetParent(rootVisual) is var parent &&
                   parent != null)
            {
                rootVisual = parent;
            }

            this.mouse = new Mouse(view, rootVisual, controlTreeRoot, config);
        }
示例#2
0
        internal InputManager(
            View view,
            UIElement uiRendererRoot,
            NoesisConfig config)
        {
            this.keyboard = new Keyboard(
                view,
                uiRendererRoot.Keyboard,
                config);

            this.mouse = new Mouse(view, uiRendererRoot, config);
        }