Applying transforms from DataTemplates in WPF
问题 I've created a DataTemplate for my objects in a ResourceDictionary file. The template is basically an image that is loaded from the disk. Now, what happens is that I want to align the image to a specific point on my Canvas but not by its upper left point but its center point, that's why I want to apply a translate transform for X = -Width / 2 and Y = -Height / 2 but I don't know how to apply them via the DataTemplate. Any help will be appreciated, thanks! 回答1: Try using databinding on Canvas'