2012-04-12 5 views
0

私はMonotouch.Dialogでの作業、およびこのエラーに実行しているよ:MonoTouch.Dialog - RootElementのグループがnullであるか、ないRADIOGROUP

The RootElement's Group is null or is not a RadioGroup 

私は次のように、私は」されて働いているコード変数の状態を伝えるコメントが追加されました:

 var groupSortChoices = new RadioGroup("S", Extensions.GetValues<PeopleDirectoryGroupSortEnum>().IndexOfItem (i => i.Element == Extensions.GetValue<PeopleDirectoryGroupSortEnum>(Options.GroupAndSort)).Value); 
// new RadioGroup("S", 0) 
     var nameDisplayChoices = new RadioGroup("N", Extensions.GetValues<PeopleDirectoryNameDisplayEnum>().IndexOfItem (i => i.Element == Extensions.GetValue<PeopleDirectoryNameDisplayEnum>(Options.NameDisplay)).Value); 
// new RadioGroup("N", 0) 

     var gsElems = Extensions.GetValues<PeopleDirectoryGroupSortEnum>() 
      .Select(e => new RadioElement(e, "S")) 
      .ToArray(); 
// String[4] array of this enum's values 
     var ndElems = Extensions.GetValues<PeopleDirectoryNameDisplayEnum>() 
      .Select(e => new RadioElement(e, "N")) 
      .ToArray(); 
// String[2] array of this enum's values 

     groupSortElement = new RootElement("Grouping and Sorting", groupSortChoices) 
     { 
      new Section("Grouping and Sorting") 
      { 
       gsElems 
      }, 
     }; 

     nameDisplayElement = new RootElement("Name Display", nameDisplayChoices) 
     { 
      new Section("Name Display") 
      { 
       ndElems 
      } 
     }; 

     var root = new RootElement("Directory Options") 
     { 
      groupSortElement, 
      nameDisplayElement 
     }; 

     this.Root = root; 

このコードを壊してデバッグしようとしました。エラーは間違いなくgroupSortElementとnameDisplayElementから来ています。私は "S"と "N"を使わずにグループを初期化しようとしましたが、同じエラーが表示されます。私はこれを数回前にやったことがあります。私の人生では、私が間違っていることを理解できません。何か案は? 2つのRadioGroupはnullではなく、groupSortElementとnameDisplayElementをコメントアウトすると、空のビューが表示され、これらの要素と関係があることがわかります。

答えて

4

私はそれを理解しました。 RootElementをRootElementに直接追加するようにしました。RootElementに含まれるセクションには追加しません。

関連する問題