c# - How can I retrieve name(Key) of applied template? -


i have template assigned button:

<button x:name="btn_patmat" template="{staticresource patmat_button}" ... 

how can retrieve key/string/name of template said button?

pseudocode:

string = btn_patmat.template.???.tostring() 

well i'm afraid that's not possible because it's not intended wpf. there people wanted access x:name similar x:key, had give up.

pls have @ so post , additional link.

the workaround imagine reading templates resourcedictionary, instantiate each resource (if possible), find template (if it's e.g. style) , compare current instance of template found in control. seems pretty ugly solution , i'm not sure if it'll work without problems.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -