Reputation: 1
I am making a website with silverlight and I stumbled on this problem;
I created a custom control(Menubutton), which has a Image and a HyperlinkButton
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:l2="clr-namespace:SilverlightApplication1.Klassen"
mc:Ignorable="d"
x:Class="SilverlightApplication1.MenuButton"
d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<Canvas x:Name="cnvMenuButton" Width="200" Height="50">
<Image Source="/SilverlightApplication1;component/Buttons/MenuButton1.png" Height="50" Width="50" />
<HyperlinkButton x:Name="btnLink" Content="HyperlinkButton" Canvas.Left="55" Canvas.Top="14" FontFamily="Lithos Pro Regular" FontSize="14.667" Foreground="Black" Background="{x:Null}" RenderTransformOrigin="0.5,0.5"/>
</Canvas>
</Grid>
</UserControl>
I want to use several of these in my mainpage, to navigate a navigationFrame to the desired page. So since the HyperlinkButtons work with the NavigateUri and the TargetName, I changed the code behind the MenuButton page so that I can specify the URI and TargetName from my mainpage
public partial class MenuButton: UserControl
{
public MenuButton()
{
// Required to initialize variables
InitializeComponent();
}
public string Titel
{
get { return btnLink.Content.ToString(); }
set { btnLink.Content = value; }
}
public string NaviUri
{
set {
Uri naviuri = new Uri(value);
btnLink.NavigateUri = naviuri;
}
}
public string TargetFrameString
{
get { return btnLink.TargetName; }
set { btnLink.TargetName = value; }
}
}
So after I specify these property's in my mainpage, I get this error : [net_uri_Badformat] Arguments : Debugging resource strings are unavailable.
code I use in my mainpage:
My Stackpanel with the custom control
<StackPanel x:Name="Menu" Orientation="Vertical" Canvas.Top="243" Height="300" Width="100" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Margin="70,290,0,126">
<StackPanel.RenderTransform>
<CompositeTransform/>
</StackPanel.RenderTransform>
<l1:MenuButton TargetFrame="contentFrame" NaviUri="Home" Titel="Home"/>
</StackPanel>
the contentframe in the same page
<navigation:Frame x:Name="contentFrame" d:LayoutOverrides="GridBox" RenderTransformOrigin="0.5,0.5">
<navigation:Frame.RenderTransform>
<CompositeTransform/>
</navigation:Frame.RenderTransform>
<navigation:Frame.UriMapper>
<navigationCore:UriMapper>
<navigationCore:UriMapping MappedUri="/Views/Home.xaml" Uri="Home"/>
<navigationCore:UriMapping MappedUri="/Views/About.xaml" Uri="About"/>
</navigationCore:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
Can anybody help me with this?
Upvotes: 0
Views: 1126
Reputation: 1
NavigationService.Navigate(new Uri("/dllPageTest;component/PageFromDll.xaml",UriKind.RelativeOrAbsolute));
This example works!))
Upvotes: 0
Reputation: 773
Looks like there's a slight oversight with your NaviUri property: It doesn't have a get method. There's no way to retrieve the value that is set.
Upvotes: 0
Reputation: 2887
You should include the second parameter to the Uri constructor: UriType.Relative
Upvotes: 1