2016-07-22 4 views
0

インタラクティブ機能は新しいウィンドウを表示する最も良い方法ですか?もしそうなら、どうすれば私のUserControlのViewModelをリセット/再初期化できますか?私はそれがポップアップを再利用するのを見るからです。インタラクティブ機能は、毎回トリガされるポップアップビューモデルをリセットできますか?

+0

この特定のインタラクティブ機能であなたが何をしているのかを教えてください。エンドユーザーにシンプルなyes/noを要求しているのですか、データの編集、検索/検索UIの検索などを許可していますか? –

+0

私は2つのリストボックスをクリアしようとしているので、次にそのウィンドウが表示されるので、それらのボックスはきれいです。 – kvuong

答えて

1

あなたの対話要求のViewModelには、Notificationという名前のプロパティが必要です。これは、リクエストが呼び出されるたびに設定されます。そこにいくつかのロジックを追加して、リストボックスをクリアします。 以下を参照してください。

public INotification Notification 
{ 
    get 
    { 
     return notification; 
    } 
    set 
    { 
     if (value is ItemSelectionNotification) 
     { 
      notification = value as ItemSelectionNotification; 
      OnPropertyChanged(() => Notification); 
      //*** Add ListBox clearing code here!! 
      // Maybe a call to a method -> ClearListBoxes(); 
     } 
    } 
} 

をこれは私のItemSelectionNotificationクラスは、あなたがそれを必要とする場合のように見えるものです。

public class ItemSelectionNotification : Confirmation 
{ 
    public ItemSelectionNotification() { } 
    public ItemSelectionNotification(object payload) 
    { 
     Payload = payload; 
    } 
    public object SelectedItem { get; set; } 
    public object Payload { get; } = null; 
} 
関連する問題