Win 8 RT routing parameters

2019-07-03 14:43发布

I have to route through different pages and pass routing parameters between them. I have made that happen and I am passing the parameters but I do not have access to the object property.

void itemClick(object sender, ItemClickEventArgs e)
        {

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

and on the other page I recive the parameter object as a navigation parameter.

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

        }

I have no access to the object's properties. I would really appreciate the help.

1条回答
对你真心纯属浪费
2楼-- · 2019-07-03 15:36

Try to cast the object to your type, like:

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

And if the type is not nullable:

var param = (MyType)navigationParameter;
查看更多
登录 后发表回答