wpf - Style embedded ControlTemplate using Style -


im using infragistics controls theming. template property set on trigger.

that template configured further hierarchy cannot edit directly want change 1 of properties set.

e.g.

template set on trigger (truncated)

<style x:key="fxtpanetabitemstyle" targettype="{x:type igdock:panetabitem}">   <setter property="textblock.texttrimming" value="characterellipsis" />     <style.triggers>       <trigger property="igdock:xamdockmanager.panelocation" value="unpinned">         <setter property="template" value="{dynamicresource {x:static igdock:panetabitem.dockabletabitemtemplatekey}}" />       </trigger>   </style.triggers> </style> 

the template configured in unreachable code (truncated)

<controltemplate x:key="{x:static igdock:panetabitem.dockabletabitemtemplatekey}" targettype="{x:type igdock:panetabitem}">  <border x:name="ctrlborder" snapstodevicepixels="true" minheight="25">   <controls:cardpanel>   <controls:cardpanel x:name="background">    <grid horizontalalignment="stretch" verticalalignment="stretch" width="auto" height="25">     <border x:name="border" margin="0,0,0,0" background="{templatebinding background}" borderbrush="{templatebinding borderbrush}" snapstodevicepixels="true"/>     <border x:name="highlightborder" margin="0" borderbrush="{dynamicresource {x:static igdock:dockmanagerbrushkeys.tabbedlistnotactiveinnerborderfillkey}}" borderthickness="0" snapstodevicepixels="true"/>    </grid>   </controls:cardpanel>  </border> <controltemplate.triggers> </controltemplate.triggers> 

i want override border (x:name="ctrlborder") minheight property. possible without replicating entire controltemplate in code base. , changing single property?

as far know, can't change template, can create custom behavior (or add code on code behind) on code used control.

on code, go on control visual hierarchy , find border name. can change properties.

it's important try find elements (border on case) on visual tree after loaded event has accor on object, because need visual created already

finding visual elements on visual hierarchy:

        public static list<t> findvisualchildren<t>(dependencyobject depobj, bool searchwithinafoundt = true) t : dependencyobject         {             list<t> list = new list<t>();             if (depobj != null)             {                 (int = 0; < visualtreehelper.getchildrencount(depobj); i++)                 {                     dependencyobject child = visualtreehelper.getchild(depobj, i);                     if (child != null && child t)                     {                         list.add((t)child);                          // means element not expected contain elements of type                         if (!searchwithinafoundt) { continue; }                     }                      list<t> childitems = findvisualchildren<t>(child, searchwithinafoundt);                     if (childitems != null && childitems.count > 0)                     {                         foreach (var item in childitems)                         {                             list.add(item);                         }                     }                 }             }             return list;         } 

it's little dirty can on specific cases


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -