Why can't I see the control of my WPF custom control? -


i have followed solution of question: how have many wpf custom controls in same library?

the problem can see controls of custom control when add custom control in main view.

however, if have style in generic.xaml file instead of mycontrol.xaml file, , have ona user control, works.

the code of mycontrol.xaml this:

<resourcedictionary     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:local="clr-namespace:customcontrols.calendario2">       <style targettype="{x:type local:calendariomes2}">         <setter property="template">             <setter.value>                 <controltemplate targettype="{x:type local:calendariomes2}">                     <border background="{templatebinding background}"                             borderbrush="{templatebinding borderbrush}"                             borderthickness="{templatebinding borderthickness}">                          <grid>                             <textbox text="prueba" borderbrush="black"/>                             <label content="prueba" borderbrush="black"/>                         </grid>                      </border>                 </controltemplate>             </setter.value>         </setter>     </style> </resourcedictionary> 

and generic.xaml has code:

<resourcedictionary     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:local="clr-namespace:customcontrols.calendario2">           <resourcedictionary.mergeddictionaries>         <resourcedictionary source="/customcontrols.calendario2;component/resourcedictionaries/calendariomes2.xaml"/>     </resourcedictionary.mergeddictionaries> </resourcedictionary> 

why can't see textbox , label?

thanks.

edit: have use absolute path file:

<resourcedictionary.mergeddictionaries>         <resourcedictionary source="f:\alvaro\ejemplos\calendario\customcontrols\themes\calendariomes2.xaml"/>     </resourcedictionary.mergeddictionaries> 

but know have error in main window can create type text. error in calendariomes2.xaml:

<resourcedictionary     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:local="clr-namespace:customcontrols.calendario2">       <style targettype="{x:type local:calendariomes2}">         <setter property="template">             <setter.value>                 <controltemplate targettype="{x:type local:calendariomes2}">                     <border background="{templatebinding background}"                             borderbrush="{templatebinding borderbrush}"                             borderthickness="{templatebinding borderthickness}">                          <grid>                             <textbox text="prueba" borderbrush="black"/>                             <label content="prueba" borderbrush="black"/>                         </grid>                      </border>                 </controltemplate>             </setter.value>         </setter>     </style> </resourcedictionary> 

in line 7:

<style targettype="{x:type local:calendariomes2}"> 

but compare code code of solution in other thread, see have same line.

this calendariomes2.cs

namespace customcontrols.calendario2 {     public class calendariomes2 : control     {         static calendariomes2()         {             defaultstylekeyproperty.overridemetadata(typeof(calendariomes2), new frameworkpropertymetadata(typeof(calendariomes2)));         }     } } 

edit: source code here: https://1drv.ms/u/s!aiteplsbavz0grdvbpjgrxeiws1u


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -