I have the following code which I'm using to provide mouse cursor feedback on a drag and drop operation. It uses a local cursor file.
private void UserControl_GiveFeedback(object sender, GiveFeedbackEventArgs e)
{
if (e.Effects == DragDropEffects.None)
{
e.UseDefaultCursors = true;
e.Handled = true;
return;
}
if (cursor == null)
{
StreamResourceInfo s = Application.GetResourceStream(new Uri(@"pack://application:,,,/Schedule/Week/ContentCopy.cur", UriKind.RelativeOrAbsolute));
cursor = new Cursor(s.Stream);
Mouse.SetCursor(cursor);
e.UseDefaultCursors = false;
}
e.Handled = true;
}
Now I want to change this code to use a Pack Icon from the Material Design in Xaml library.
I can get the icon like this in code:
using MaterialDesignThemes.Wpf;
var icon = new PackIcon { Kind = PackIconKind.DocumentCopy };
But I don't know how to convert it to a stream that's suitable for consumption by the Cursor
object.