I'm using a DesignTime DataContext
inside of my WPF Styles
to get full IntelliSense
support.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:alarm="clr-namespace:Foo.Alarm;assembly=HtCore"
mc:Ignorable="d">
<Style TargetType="TreeViewItem" d:DataContext="{d:DesignInstance alarm:HtAlarmBase}">
</Style>
</ResourceDictionary>
But the Designer
highlights
it and says:
The property "DataContext" does not exist in the "http://schemas.microsoft.com/expression/blend/2008" namespace
Is there a solution to hide this "error message"?
You could try:
<Style TargetType="TreeViewItem">
<d:Style.DataContext>
<x:Type Type="alarm:HtAlarmBase" />
</d:Style.DataContext>
</Style>
I don't really follow where you're headed with this though.
I would usually provide a design time datacontext for a whole view, including data for the treeview items. Without that, I wouldn't have any treeview items at all to show in the designer.
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