0

ここに私のxamlがあります

<Window.Resources>
    <sampleData:MainWindow  x:Key="DataSource"/>
    <DataTemplate x:Key="CustomComponentParameter">
        <TextBlock Text="{Binding Name}" />
    </DataTemplate>
    <HierarchicalDataTemplate x:Key="CustomComponent" ItemTemplate="{StaticResource CustomComponentParameter}"
       ItemsSource="{Binding Parameters }">
        <TextBlock Text="{Binding Name}" />
    </HierarchicalDataTemplate>
</Window.Resources>

テレリックコントロール用

    <telerik:RadTreeView ItemsSource="{Binding Source={StaticResource DataSource},Path=SummaryViewCollection}"  ItemTemplate="{StaticResource CustomComponent}" HorizontalAlignment="Left" Height="77" Margin="345,482,0,0" VerticalAlignment="Top" Width="449">

    </telerik:RadTreeView>

ここに私のコードビハインドクラスがあります

メイン分離コード クラス MainWindow.xaml.cs のコード

 public partial class MainWindow : Window
 {
    public ObservableCollection<CustomComponent> SummaryViewCollection { get; set; }
    public MainWindow()
    {          
       this.SummaryViewCollection = //code to fill in the details 
    }           
 }

CustomComponentClass のコードは次のとおりです。

public class CustomComponent
{

    private ObservableCollection<CustomComponentParameter> parameters = new ObservableCollection<CustomComponentParameter>();


    public string Name
    {
        get;
        set;        
    }     

    public ObservableCollection<CustomComponentParameter> Parameters
    {
        get
        {
            return this.parameters;
        }

        set
        {
            this.parameters = value;
        }
    }
}

CustomComponentParameter クラスのコード

public class CustomComponentParameter
{       
    public string Name
    {
        get;set;
    }

    public string Value
    {
        get;set;
    }

    public bool HasErrors
    {
        get;set;
    }

    public bool IsDuplicate
    {
        get;set;
    }


    public bool IsMissing
    {
        get; set;
    }
}

実行するたびに、「mscorlib.dll で 'System.StackOverflowException' 型の未処理の例外が発生しました」というエラーが表示されます。現在のスレッドがスタック オーバーフロー状態にあるため、式を評価できません。これに関する提案はありますか?ありがとう

4

2 に答える 2

2

私の場合、 DataBind() への余分な呼び出しがこの例外を引き起こしていました。その余分な呼び出しを削除すると、問題が修正されました。

于 2014-07-24T00:47:08.497 に答える