When I add a resource on my main application (Application.xaml) then my pages doesn't load its design viewer because it tells me there is an error in one resource (DesignerItem.xaml). Otherwise in run time it works perfectly.
Application.xaml:
<Application xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
x:Class="GesHoras.App"
StartupUri="WinMain.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--Vista Theme -->
<ResourceDictionary Source="pack://application:,,,/PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml" />
<ResourceDictionary Source="Themes/TabControl.xaml"/>
<ResourceDictionary Source="Themes/TabItem.xaml"/>
<ResourceDictionary Source="Themes/GridView.xaml"/>
&l开发者_运维问答t;ResourceDictionary Source="Themes/ListView.xaml"/>
<ResourceDictionary Source="Themes/Button.xaml"/>
<ResourceDictionary Source="Themes/RepeatButton.xaml"/>
<ResourceDictionary Source="Themes/GroupBox.xaml"/>
<ResourceDictionary Source="Themes/TextBox.xaml"/>
<ResourceDictionary Source="Themes/ComboBox.xaml"/>
<ResourceDictionary Source="Themes/TreeView.xaml"/>
<!--<ResourceDictionary Source="Themes/Menu.xaml"/>-->
<ResourceDictionary Source="Themes/ProgressBar.xaml"/>
<ResourceDictionary Source="Themes/ToolTip.xaml"/>
<ResourceDictionary Source="Designer_Controls/DesignerItem.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
and my DesignerItem.xaml:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:GesHoras.Designer_Controls">
<!-- Resource dictionary entries should be defined here. -->
<!-- DragThumb Default Template -->
<Style TargetType="{x:Type s:DragThumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type s:DragThumb}">
<Rectangle Fill="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DesignerItem Style -->
<Style TargetType="{x:Type s:DesignerItem}">
<Setter Property="MinWidth" Value="20"/>
<Setter Property="MinHeight" Value="15"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type s:DesignerItem}">
<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
<!-- PART_DragThumb -->
<s:DragThumb x:Name="PART_DragThumb" Cursor="Hand"/>
<!-- PART_ContentPresenter -->
<ContentPresenter x:Name="PART_ContentPresenter"
Content="{TemplateBinding ContentControl.Content}"
Margin="{TemplateBinding ContentControl.Padding}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
It tells me the error is in DesignerItem.xaml in line:
<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
the message error that appears is:
Property 'Path' has no value
Can anyone help me please?
Thanks!
DesignerItem.xaml:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:GesHoras.Designer_Controls">
<!-- Resource dictionary entries should be defined here. -->
<!-- DragThumb Default Template -->
<Style TargetType="{x:Type s:DragThumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type s:DragThumb}">
<Rectangle Fill="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DesignerItem Style -->
<Style TargetType="{x:Type s:DesignerItem}">
<Setter Property="MinWidth" Value="20"/>
<Setter Property="MinHeight" Value="15"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type s:DesignerItem}">
<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
<!-- PART_DragThumb -->
<s:DragThumb x:Name="PART_DragThumb" Cursor="Hand"/>
<!-- PART_ContentPresenter -->
<ContentPresenter x:Name="PART_ContentPresenter"
Content="{TemplateBinding ContentControl.Content}"
Margin="{TemplateBinding ContentControl.Padding}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
The problem is in line:
<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
It says to me that path is missing or has no value.
Thanks!
精彩评论