wpf - Including resource dictionary in UserControl.Resources fails to compile -


i have custom control want apply styles resource dictionary in project. reason, adding resources in usercontrol.resources fails, placing in grid.resources succeeds;

<usercontrol x:class="my.name.space.myusercontrol"              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"              mc:ignorable="d" d:designheight="200" d:designwidth="300">      <usercontrol.resources>         <resourcedictionary x:key="usercontrolresources">             <!--putting here fails-->         </resourcedictionary>     </usercontrol.resources>      <grid>         <grid.resources>             <resourcedictionary x:key="gridresources">                 <!--putting here succeeds-->             </resourcedictionary>         </grid.resources>          <!--control xaml-->      </grid>  </usercontrol> 

i error "the name 'intializecomponent' not exist in current context". however, looking @ autogenerated myusercontrol.g.i.cs file, hey presto; there is. doing wrong? difference between these 2 declarations?

thanks, sterren


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -