この問題を回避するために多くのことを試みましたが、正しい答えが見つからないようです。
私はDataGrid
6 列で、ユーザーは列 6の任意の行をクリックしたときにのみ他のページにリダイレクトする必要があります。
したがって、ユーザーは の下のセルのみをクリックできますTo-Do
。Type
彼らがその行をクリックすると、そのセルと同じ行にあるものを見つける必要があります。EG 6 をクリックした場合To-Do
、行タイプをクリックしたことがわかるはずFootball
です。
次に、最初の列にある を別のページに渡して、その下にあるすべての異なるアイテムを表示Type
できるようにします。To-Do
Type
これは私が試したものです:
cSViewEntity selectedView = dgFake.SelectedItem as cSViewEntity;
AllocateAudits page = new AllocateAudits()
{
DataContext = selectedView
};
FrameNavigation.Navigate(page);
しかし、私がこれを行ったとき、このメソッドにはヒットしません:
public void Page_OnNavigatedTo(object sender, NavigationEventArgs e)
{
var newDataContext = e.Content;
_View = (cSViewEntity)newDataContext;
_Transactions = new List<cAuditTransactionTypeEntity>();
_Transactions = sp.GetTransactionTypes().ToList();
string TransactionType = _View.TransactionType;
int TransactionTypeID = _Transactions.FirstOrDefault(w => w.TransactionType == TransactionType).TransactionTypeId;
dgAllocate.ItemsSource = sp.GetTransactionsNotEvaluated(TransactionTypeID).ToList();
}
どんな助けもとても役に立ちます、
ありがとう。
質問への回答:
SelectedItem を別のページに渡し、そのページで Type を見つけて、その Type でストアド プロシージャを実行しました。
cSViewEntity obj = (cSViewEntity)dgFake.SelectedItem;
AllocateAudits page = new AllocateAudits(obj)
{
DataContext = obj
};
FrameNavigation.Navigate(page);
}
そして、それをコンストラクターに渡し、メソッドの最初にこれを追加します。
private void Rawr(cSViewEntity obj)
{
var transactiontype = _obj.TransactionType;
//Stores the information from newDataContext to the entity with the name of _View.
_View = (cSViewEntity)obj;