You can create an Action and drag it on top of the control you want to do, how it happens:
public class NavigateAction : TriggerAction<DependencyObject>
{
public Uri Uri
{
get;
set;
}
protected override void Invoke(object parameter)
{
var frame = FindContainingFrame(AssociatedObject);
if(frame == null)
throw new InvalidOperationException("Could not find the containing Frame in the visual tree.");
frame.Navigate(Uri);
}
protected static Frame FindContainingFrame(DependencyObject associatedObject)
{
var current = associatedObject;
while(!(current is Frame))
{
current = VisualTreeHelper.GetParent(current);
if(current == null)
return null;
}
return (Frame)current;
}
}
Now you just need to drag it and connect to the landing page. By the way, this is true for SL4, never tried on SL3. and the URI works in the form: " /SilverlightApplication1;component/Page1.xaml " or with UriMapping in the frame.
source
share