✅ Abstract classes as the WPF DesignContext?

Does it matter if the value in d:DesignContext="{d:DesignInstance Type=X}" is an abstract class. I can't get the WPF design to acknowledge my type. I know some of you guys have said not to rely on it, but it does help from time to time and I at least like the design context set. I've tried deleting the bin and obj folders for that project and restarting VS. Didn't help.
<Base:AbstractVisualConversationTabCtrl
x:Class="BestChat.IRC.Global.View.ConversationViewCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BestChat.IRC.Global.View"
xmlns:Base="clr-namespace:BestChat.GUI.Ctrls;assembly=BestChat.GUI.Ctrls"
xmlns:OurDataCtxt="BestChat.Platform.Conversations;Assembly=BestChat.Platform.Conversations"
xmlns:DataDefs="clr-namespace:BestChat.IRC.Data.Defs;assembly=BestChat.IRC.Data"
xmlns:CalcBinding="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:Emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
xmlns:Ctrls="clr-namespace:BestChat.IRC.Global.View.Ctrls;assembly=BestChat.IRC.Global.View.Ctrls"
xmlns:GuiCtrls="clr-namespace:BestChat.GUI.Ctrls;assembly=BestChat.GUI.Ctrls"
d:DataContext="{x:Type d:DesignInstance Type=OurDataCtxt:AbstractConversation}"
mc:Ignorable="d">
<Base:AbstractVisualConversationTabCtrl
x:Class="BestChat.IRC.Global.View.ConversationViewCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BestChat.IRC.Global.View"
xmlns:Base="clr-namespace:BestChat.GUI.Ctrls;assembly=BestChat.GUI.Ctrls"
xmlns:OurDataCtxt="BestChat.Platform.Conversations;Assembly=BestChat.Platform.Conversations"
xmlns:DataDefs="clr-namespace:BestChat.IRC.Data.Defs;assembly=BestChat.IRC.Data"
xmlns:CalcBinding="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:Emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
xmlns:Ctrls="clr-namespace:BestChat.IRC.Global.View.Ctrls;assembly=BestChat.IRC.Global.View.Ctrls"
xmlns:GuiCtrls="clr-namespace:BestChat.GUI.Ctrls;assembly=BestChat.GUI.Ctrls"
d:DataContext="{x:Type d:DesignInstance Type=OurDataCtxt:AbstractConversation}"
mc:Ignorable="d">
Then inside BestChat.Platform.Conversations.dll, we have BestChat.Platform.Conversations.AbstractConversation. Those appear to match to me.
namespace BestChat.Platform.Conversations
{
public abstract class AbstractConversation
.
.
.
}
namespace BestChat.Platform.Conversations
{
public abstract class AbstractConversation
.
.
.
}
14 Replies
JakenVeina
JakenVeina8mo ago
if you've tried it and it doesn't work, I'd have to say "yes, it matters"
Will Pittenger
Will Pittenger8mo ago
In which case, the error should be the class was abstract.
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will Pittenger8mo ago
Please remember I don't need design time data. Just making sure the property names are valid.
JakenVeina
JakenVeina8mo ago
yeah, the syntax is fine I use it myself, regularly but yeah, doesn't work for abstract classes oh wait no @TeBeClone is right, the alternative syntax does work use {x:Type} to do the type lookup works fine
Will Pittenger
Will Pittenger8mo ago
I tried that.
JakenVeina
JakenVeina8mo ago
then you're doing something else wrong even works with an abstract generic
d:DataContext="{d:DesignInstance Type={x:Type gamespace:GameBoardViewModelBase`1}}"
d:DataContext="{d:DesignInstance Type={x:Type gamespace:GameBoardViewModelBase`1}}"
I now get intellisense on all the other bindings
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will Pittenger8mo ago
Except I tried d:DataContext="{d:DesignInstance Type={x:Type OurDataCtxt:AbstractConversation}}" too.
JakenVeina
JakenVeina8mo ago
¯\_(ツ)_/¯ wOrKs On My MaChInE
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will Pittenger8mo ago
.NET 7.0 in VS 2022?
JakenVeina
JakenVeina8mo ago
this one's actually net6.0-windows but it shouldn't matter so long as it's .NET 5+ or was it 6 when WPF was added?
Will Pittenger
Will Pittenger8mo ago
Well, I took the DesignInstance stuff out for now. I'm back to trying to resolve https://discord.com/channels/143867839282020352/1170760309410107473.
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Want results from more Discord servers?
Add your server
More Posts
✅ Null check not enough to safely convert from nullable enumI have a class declaring an `enum` and a nullable value for that `enum`: ```CS public readonly StdMo❔ How do I change the color of certain targets when they're shot, and also destroy others when shot?I have tagged the ones to be destroyed as destroy and the ones that change color as color, but neith❔ unity single jumpHi, I need some help about jump mechanics in unity, I have written a code that suppose to make the p❔ i don't have enough (any) experience with semaphores to know if my wpf app requires themi started a new role very recently and my first project is helping a client, an electrical engineer,❔ Wpf massive memory overheadHey guys, I have this wpf window which enables me to select a rectangle on the screen. It gets open✅ Stored Procedure HelpHello, I have a stored procedure in my project called `spGetVendor`. It takes one parameter, `@Vendo❔ Console.ReadLine != nullHi all, I'm went trough this Microsoft challenge (unsuccessfully) and after reviewing this solution✅ New to wpf and need some help with architecture.I have a game-listener that gets new information every second. I crreate an instance and start the ✅ Kinda new to MVC/C#/Razor - Need some help passing data from Model -> ControllerAs the title states, I'm kinda new to C#/MVC with a good bit of experience with software development✅ WPF Custom control should have contents as DockPanel, but it shows up at runtime as ScrollViewerI have a `UserControl` I'm implementing with the source shown below. When I check my custom control