Skip to content

Solution: WPF usercontrol does not accept userinput when host in a EdmTaskPAge #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AmenJlili opened this issue Feb 26, 2022 · 1 comment
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@AmenJlili
Copy link
Member

AmenJlili commented Feb 26, 2022

Issue:

  • Create a WPF usercontrol with any input and host in an EdmTaskPage.
  • Compile add-in and add to the vault.
  • Create task and choose add-in from dropdown.
  • See created tab to replicate issue.
@AmenJlili AmenJlili self-assigned this Feb 26, 2022
@AmenJlili AmenJlili added the bug Something isn't working label Feb 26, 2022
@AmenJlili
Copy link
Member Author

Code below seems to fix the issue:

public partial class ConditionsWpf : UserControl
    {
        #region Public Constructors

        private const UInt32 DLGC_WANTARROWS = 0x0001;
        private const UInt32 DLGC_WANTTAB = 0x0002;
        private const UInt32 DLGC_WANTALLKEYS = 0x0004;
        private const UInt32 DLGC_HASSETSEL = 0x0008;
        private const UInt32 DLGC_WANTCHARS = 0x0080;
        private const UInt32 WM_GETDLGCODE = 0x0087;

        public ConditionsWpf()
        {
            InitializeComponent();
            Loaded += delegate
            {
                HwndSource s = HwndSource.FromVisual(this) as HwndSource;
                if (s != null)
                    s.AddHook(new HwndSourceHook(ChildHwndSourceHook));
            };
        }


        IntPtr ChildHwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (msg == WM_GETDLGCODE)
            {
                handled = true;
                return new IntPtr(DLGC_WANTCHARS | DLGC_WANTARROWS | DLGC_HASSETSEL);
            }
            return IntPtr.Zero;
        }

        #endregion
    }

@AmenJlili AmenJlili added the documentation Improvements or additions to documentation label May 14, 2024
@AmenJlili AmenJlili changed the title WPF DataGrid does not accept userinput when host in a TaskSetupPage Solution: WPF DataGrid does not accept userinput when host in a EdmTaskPAge May 16, 2024
@AmenJlili AmenJlili changed the title Solution: WPF DataGrid does not accept userinput when host in a EdmTaskPAge Solution: WPF usercontrol does not accept userinput when host in a EdmTaskPAge May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant