I have something of an odd error I am trying to rid myself of. I created a custom .cur Cursor for one of my applications. I have loaded the custom cursor into the project in an image folder, set it to my resources, and made a static class for to open the media stream to for it and pass the cursor to the windows. From there in my XAML I have the following code:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:myCtrls="clr-namespace:UserControlsLibrary;assembly=UserControlsLibrary"
xmlns:pos="clr-namespace:POSystem"
x:Name="Main" x:Class="POSystem.MainWindow"
Title="Purchase Order"
Cursor="{Binding Source={x:Static pos:POProperties.LTC_Cursor}, Mode=OneWay}"
Height="850" Width="1100" Background="{StaticResource BackgroundImage}"
Icon="Images/logo_only_Xns_icon.ico">
<Grid x:Name="TheGrid" Focusable="True"
MouseDown="ClearFocus_OnClick" Background="Transparent">
<StackPanel x:Name="Panelicus">
</StackPanel>
</Grid>
</Window>
I found this method of binding to static classes here and it technically works. The problem is that even though i have built the project and even run the code successfully it shows an invalid markup error with the description:
The name "POProperties" does not exist in the namespace "clr-namespace:POSystem"
This error, however, is incorrect but it is causing me to be unable to use the XAML designer in Visual Studio.
The POProperties code:
namespace POSystem
{
public static class POProperties
{
private static Cursor _ltc_cursor;
public static Cursor LTC_Cursor
{
get => _ltc_cursor ?? new Cursor(new System.IO.MemoryStream(Properties.Resources.LTC_Custom_Cursor));
set => _ltc_cursor = value;
}
}
}