How to add dynamically created hyperlink to stack panel programmatically : i am creating hyperlinks and want to add it to stack panel.

    for (int i = 1; i <= links.Length; i++)
                        {
                            Hyperlink hyperlink = new Hyperlink()
                            {
                                NavigateUri = new Uri(links[i - 1])
                            };
    }
     hyperlink.RequestNavigate += new System.Windows.Navigation.RequestNavigateEventHandler(this.Hyperlink_RequestNavigate);
                            mainControl.Children.Add(hyperlink);

it gives me error - cannot convert to system.windows.documents.hyperlink to system.windows.uielement. i understand the namespace error but didn't find resolution because in uielement i dint find hyperlink. please provide the solution.