3

我必须通过不同的页面进行路由并在它们之间传递路由参数。我已经做到了,我正在传递参数,但我无权访问对象属性。

void itemClick(object sender, ItemClickEventArgs e)
        {

            this.Frame.Navigate(typeof(Views.SongPicker) , e.ClickedItem );
        }

在另一页上,我将参数对象作为导航参数接收。

 protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {

        }

我无权访问对象的属性。我非常感谢您的帮助。

4

1 回答 1

2

尝试将对象转换为您的类型,例如:

protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
    {
        var param = navigationParameter as MyType;
    }

如果类型不可为空:

var param = (MyType)navigationParameter;
于 2012-11-14T09:20:43.313 回答