I have a ResourceDictionary in a file separate from the UserControl, named MyControl.xaml, I'm making. At the top of my that page, I put
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources;component/AppDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="MyTextBoxStyle" BasedOn="{StaticResource ThisTextBoxStyle}" TargetType="TextBox">
<Setter Property="Margin" Value="10,0,10,0"/>
</Style>
<Style x:Key="MyLabelStyle" BasedOn="{StaticResource ThisLabelStyle}" TargetType="TextBlock">
<Setter Property="Margin" Value="10,20,0,0"/>
</Style>
</ResourceDictionary>
</UserControl.Resources>
The first StaticResource is seen just fine by VS, no warnings/errors. However, with the second one it says, "The resource 'ThisLabelStyle' could not be resolved." But then it compiles and runs just fine. There is nothing even in either style. Is it just VS being weird?
Using VS 2015. I even use other StaticResources later in the file, some have no problem, others have the same error, no connection between them as far as I can see.
DynamicResource
. – aybe