Name cannot be found in the name scope of 'System.Windows.Controls.Button'

后端 未结 2 688
暖寄归人
暖寄归人 2020-12-11 16:04

I have the following Template for my Button


    
        

        
相关标签:
2条回答
  • 2020-12-11 16:43

    The problem is indeed caused by the ItemsControl which makes the Button and its resources in a different scope.

    A simple fix would be, instead of using Storyboard.TargetName, use Storyboard.Target binding instead, something like this -

    Storyboard.Target="{Binding ElementName=col1}"

    0 讨论(0)
  • 2020-12-11 17:06

    Try using x:Name instead of Name in

    <ColumnDefinition Name="col1" Width="{Binding ElementName=root, Path=DataContext.gla.LeftGridWidth}" />
    
    0 讨论(0)
提交回复
热议问题