c# - How to make a BaseUserControl meant for inheritance -


i need create baseusercontrol has custom code behind , inherits usercontrol, used parrentclass for, used, usercontrols. have read numerous articles can not work. baseusercontrol not supossed have design elements purely custom stuff references used in other usercontrols inherit it, design element apriciated. require more baseusecontrols exstensions out of question. baseusercontrol in 1 project, , rest inherits in another.

1) tried create class inherits.

public class entryusercontrolbase:usercontrol {     public entryusercontrolbase()     {      } } 

2) inheriting usercontrol

<usercontrol x:class="spis_base.entryusercontrolbase"          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="300" d:designwidth="300">     <grid>      </grid> </usercontrol> 

i tried inherit this

<local:entryusercontrolbase x:class="spis.appcontrols.ucllogin"          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"          xmlns:local="clr-namespace:spis_base;assembly=spis_base"          mc:ignorable="d"           d:designheight="200" d:designwidth="300">     <grid horizontalalignment="stretch" verticalalignment="stretch" showgridlines="false">      </grid> </local:entryusercontrolbase>   

i found many articles explain how it, cant run.

any tips?

i'm using following inherit base properties , functions in usercontrols.

//base class using system.windows.controls; namespace controls {     public class baseusercontrol: usercontrol     {         protected string gettext()         {             return "hello world";         }     } }   //sub class <controls:baseusercontrol x:class="mynamespace.myusercontrol"          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"          xmlns:controls="clr-namespace:controls;assembly=myassembly"> </controls:baseusercontrol>  using controls; public partial class myusercontrol : baseusercontrol {     public myusercontrol ()     {         var basetext = gettext();     } } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -