I have a public class
public class FCabinetNames:List<string>
{
BusinessLogic admintasks = new BusinessLogic();
public FCabinetNames()
{
try
{
List<CabinetData> cab1 = admintasks.CabinetDataforGrid();
foreach (var c1 in cab1)
{
this.Add(c1.CabinetName);
}
}
catch
{
}
}
}
Now in the xaml page when i try to add this class as a static resource i get the 'cannot create instance of' as below
Please guide.
UPDATE :
An important point i missed telling. The application compiles fine and the xaml page also loads fine. I was planing to use this as a datasource and expectedly that remains blank.
I've had similar issues in the past. Most of the time its components and references that your custom class is trying to load.
The two step solution that works most often for me:
if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
return;
Both steps help the xaml designer from loading components that may have issues with the being in a debug state. @Heinzi is pretty much spot on with "something" throwing errors, usually (in my experience) its something buried that you wouldn't expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With