2015-09-15 28 views
0

導致StackOverflowException的頁面上的示例xaml代碼。 如果從第二個元素中刪除MyProperty="{Binding ElementName=SourceFlyout}",則可以使用 。 MyProperty是附屬財產。 AdvancedBehavior是最簡單的行爲類,錯誤很容易被重現。 MyProperty是一個空的附屬或依賴屬性,裏面沒有邏輯。怎麼了?引起StackOverflowException的依賴屬性

<ListPickerFlyout x:Name="SourceFlyout"> 
    <helpers:XamlExtention.Behaviors> 
     <helpers:BehaviorCollection> 
      <behaviors:AdvancedBehavior MyProperty="{Binding ElementName=DestinationFlyout}" /> 
     </helpers:BehaviorCollection> 
    </helpers:XamlExtention.Behaviors> 
</ListPickerFlyout> 

<ListPickerFlyout x:Name="DestinationFlyout"> 
    <helpers:XamlExtention.Behaviors> 
     <helpers:BehaviorCollection> 
      <behaviors:AdvancedBehavior MyProperty="{Binding ElementName=SourceFlyout}" /> 
     </helpers:BehaviorCollection> 
    </helpers:XamlExtention.Behaviors> 
</ListPickerFlyout> 
+0

所附屬性的最終實際數據是多少? – OmegaMan

+0

ListPickerFlyout – Dmitry

+0

「ListPickerFlyout」的實際定義是什麼? – OmegaMan

回答

1

行爲AdvancedBehavior並不期望通過MyProperty綁定到一個SourceFlyout,你需要確定的正常工作需要MyProperty的實際數據。