[UWP]How to include the cursor .res file to the control library project.

Mohana Priya 1 Reputation point
2022-01-27T12:22:52.437+00:00

Hi Team,

I have created a DLL(Universal Windows) project to define the custom cursor resource file using the below link.

https://social.msdn.microsoft.com/Forums/en-US/14001796-bcd5-4b9d-9d7e-13bc6ba59d2d/uwp-how-to-set-a-pointer-cursor-as-a-circle-instead-of-a-window-default-cursor?forum=wpdevelop

have faced this "System.ArgumentException: 'Value does not fall within the expected range" exception while using the below code in my library project.

Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Custom, 101);

Kindly suggest how to include that resource file in the control lib project

Regards,
Mohana Priya R

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,851 Reputation points
    2022-01-28T02:07:13.377+00:00

    Hello,
    Welcome to Microsoft Q&A!

    Value does not fall within the expected range" exception while using the below code in my library project.

    I have referred steps you mentioned above, we could use the custom Cursor, please check if you have Copy Resource.res file to UWP project directory like the following folder.
    if I miss adding <Win32Resource>Resource.res</Win32Resource> in UWP project .csproj file, it will throw expected range exception. So please refer above case link 7-4 steps add <Win32Resource>Resource.res</Win32Resource> into UWP project .csproj file, it will work well.

    169256-image.png

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments