Dom*_*nas 2 wpf resharper xaml
我在我的DataContext内部使用DesignTime WPF Styles获得全面IntelliSense支持.
<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>
Run Code Online (Sandbox Code Playgroud)
但Designer highlights它并说:
" http://schemas.microsoft.com/expression/blend/2008 "命名空间中不存在"DataContext"属性
是否有隐藏此"错误消息"的解决方案?
就我个人而言,我遇到了类似的错误,它抱怨样式不存在,我只需要切换xmlns:d="http://schemas.microsoft.com/expression/blend/2008"到xmlns:d="http://schemas.microsoft.com/expression/blend/2010"它即可再次编译。
你可以尝试:
<Style TargetType="TreeViewItem">
<d:Style.DataContext>
<x:Type Type="alarm:HtAlarmBase" />
</d:Style.DataContext>
</Style>
Run Code Online (Sandbox Code Playgroud)
我并没有真正关注你的目标.
我通常会为整个视图提供设计时datacontext,包括树视图项的数据.没有它,我根本就没有任何树形图项目可以在设计师中展示.
| 归档时间: |
|
| 查看次数: |
718 次 |
| 最近记录: |