2012-01-18 3 views
2

을 편집 한 후 업데이트되지 :Monotouch.dialog EntryElement 내가 대화 만들려면이 코드를 사용하고

SettingsDialog settingDialog = new SettingsDialog(); 
RootElement dialog = settingDialog.CreateDialog(); 
DialogViewController dv = new DialogViewController (dialog, true); 
dv.ViewDissapearing += delegate(object sender1, EventArgs e1) { 
    // update the values 
    Config.VendorId = settingDialog.VendorId; 
} ; 
NavigationController.PushViewController (dv, true); 

를 Ths는 SettingsDialogClass

public class SettingsDialog 
{ 
    private EntryElement idElement; 
    public RootElement CreateDialog() 
    { 
    idElement = new EntryElement ("Vendor Id", string.Empty, Config.VendorId.ToString (CultureInfo.InvariantCulture)){ KeyboardType = UIKeyboardType.NumberPad }; 

    element = new RootElement ("Configuration"){ 
    new Section(){ 
    idElement 
    } , 
    ... 
} 

public string VendorId { 
get { 
    return idElement.Value; 
} 
} 

문제에 대한 코드는 위의 것입니다 속성은 항상 이전 값을 반환하며 업데이트되지 않습니다. 그 이유는 무엇입니까?

감사, 이그나시오

답변

2

내 질문에 대한 답을 발견,이 스레드는 열쇠를 가지고

How can I pass data into MonoTouch.Dialog's delegates?

이 라인 : 내가 필드를 호출하여 주위에 얻을 수있었습니다 .FetchValue()를 검색하려고 시도하기 전에

따라서 속성을

으로 수정했습니다.210
public string VendorId { 
get { 
    idElement.FetchValue(); 
    return idElement.Value; 
} 
} 
관련 문제