Wpf, style is not being applied

前端 未结 6 1756
执念已碎
执念已碎 2021-01-13 14:25

I\'ve written a user control with popup, who\'s content is being set outside the control. The ControlTemplate of that control looks like the following:



        
6条回答
  •  别那么骄傲
    2021-01-13 14:43

    I received answer on Microsoft forums; I'll leave it here in case someone encounters the same problem.

    The difference is that a TextBlock is not a control, i.e. it doesn't have any ControlTemplate and because of this the implicit style doesn't get applied to it when it is located inside the StackPanel. Please see the following page for more information: http://blogs.msdn.com/b/wpfsdk/archive/2009/08/27/implicit-styles-templates-controls-and-frameworkelements.aspx

    You could use Label elements or set the style for the TextBlock elements explicitly.

    -- Magnus (MM8)

提交回复
热议问题