where can I find documentation for visual structures for different controls and what target property they have (used in ControlTemplate)?


  • For instance, I ran into this ControlTemplate for gridview today:

    <ControlTemplate TargetType="GridView">
        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
            <ScrollViewer x:Name="ScrollViewer" ViewChanged="OnViewChanged" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsHorizontalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsHorizontalScrollChainingEnabled}" IsVerticalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsVerticalScrollChainingEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" TabNavigation="{TemplateBinding TabNavigation}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
                <ItemsPresenter HeaderTemplate="{TemplateBinding HeaderTemplate}" Header="{TemplateBinding Header}" HeaderTransitions="{TemplateBinding HeaderTransitions}" Padding="{TemplateBinding Padding}"/>

    My question if I was going to write this, how could I know the visual structure of


    can be the visual structure for gridview?

    Also in the code I ran into, it used a lot of template binding, from where could I know this target property that is template binded to belongs to grid view? For example,

    TemplateBinding ScrollViewer.HorizontalScrollBarVisibility

    From where can I know that gridview has a target property called ScrollViewer to be template binding to?

    Basically I am asking where can I find documentation for (default) visual structure of different controls and target property of different controls.



    Tuesday, November 27, 2012 12:57 AM

All replies

  • The structure can be pretty much anything you want, so long as you include essential parts such as the ItemsPresenter.

    You can get a good hint by looking at the default templates for your control in the SDK in C:\Program Files (x86)\Windows Kits\8.0\Include\WinRT\Xaml\Design\generic.xaml (the path may be different if you installed the SDK elsewhere). You can generate a copy of the template in the designer by selecting the control and using the Edit Template... menu.


    Tuesday, November 27, 2012 1:11 AM
  • wow, thanks Rob. That's exactly what I wanted and it also solve my second question (From where can I know that gridview has a target property called ScrollViewer to be template binding to).

    Is this the deepest level I can dig into (more deeper ones does not have source code to look into and is compiled into WinRT library?)

    I am asking this because in the file you mentioned, in gridview style for example,

                                    Header="{TemplateBinding Header}" 
                                    HeaderTemplate="{TemplateBinding HeaderTemplate}"
                                    HeaderTransitions="{TemplateBinding HeaderTransitions}"
                                    Padding="{TemplateBinding Padding}"/>

    It still templatebinding to somewhere. So I am curious to find where that "somewhere" is, is it in view-able source code to me, or already compiled into binary?

    Thanks for the great and fast answer!


    Tuesday, November 27, 2012 1:22 AM