【问题标题】:Bind label in ControlTemplate to Window title将 ControlTemplate 中的标签绑定到窗口标题
【发布时间】:2012-01-20 16:34:06
【问题描述】:

对于一个新应用程序,我为一个窗口创建了一个自定义 ControlTemplate,以便所有窗口都具有相同的外观和感觉。当我将属性WindowStyle 设置为none 并将AllowsTransparency 设置为true 时,我需要创建自己的窗口控件(如关闭按钮、标题栏等)。

是否有可能仅通过使用模板中的 xaml 代码将包含在 ControlTemplate 中的标签文本绑定到该窗口的窗口标题?

【问题讨论】:

    标签: wpf c#-3.0 controltemplate


    【解决方案1】:

    {TemplateBinding Title} 应该这样做 (TemplateBinding reference)。

    【讨论】:

      最近更新 更多