c# - Is it possible to use reflection directly in XAML -


in db have table contains different items of usercontrols attributes "classname", "assemblyname" , "namespace" necesarry init instances using reflection.

my idea collection db, set collection data-context , dynamically load these usercontrols tabcontrol. use "tabitem" contain , in runtime in code behind load it. guess handy , fancy if done directly xaml in template.

i've been googleling similar, found nothing without using code behind.

i thinking following

        <tabcontrol.contenttemplate>             <datatemplate>                 <xxxcontrol classname="{binding classname}" assemblyname="{binding assemblyname}" namespace="{binding namespace}" />             </datatemplate>         </tabcontrol.contenttemplate> 

i make such custom "xxxcontrol" waste of time if exists. way gui completly generated parameters in db.

you can lot of things in xaml using markup extensions, in case create 1 instantiates controls given information. needs dependency properties can bound, , in providevalue assembly, construct full name , instantiate it.

usage:

<datatemplate>     <me:instance assembly="{binding assemblyname}"                  namespace="{binding namespace}"                  class="{binding classname}"/> </datatemplate> 

obviously still have code-behind, how should be, imperative code not belong in xaml @ all.

also doubt data-base should contain information ui controls...


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -