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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -