I could not understand BorderThickness="{TemplateBinding BorderThickness}
.
Here the code:
<ControlTemplate TargetType="{x:Type wpftoolkit:DataGridCell}">
<Border Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</ControlTemplate>
Also please explain other types of binding.
TemplateBinding is used for binding to the element properties within the template definition. In your example, you could have written:
<Border Padding="{Binding Padding}" ...>
...meaning to bind the border's padding property to the padding property of... what? You'd like to say, "padding property of the control that this template is being used for." You can't give it a name because you don't know the x:Name of the control at this time (even if you did, it wouldn't work because it's in a different namescope). However, you can do this by defining a relative source
<Border Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}" ...>
or use TemplateBinding, which is a shortcut(*) for above
<Border Padding="{TemplateBinding Padding}" ...>
(*) In addition to being less verbose in these templating scenarios, TemplateBinding has a couple of differences compared to a regular binding: