0

I got this ConfigurationUserCOntrol

<UserControl x:Class="NeoClinic.MAS.ConfigurationsList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             >
    <Grid Style="{StaticResource ContentRoot}">
        <!-- TODO: set @SelectedSource -->
        <mui:ModernTab x:Name="ModTab" Layout="List" PreviewMouseLeftButtonUp="ModTab_PreviewMouseLeftButtonUp" >
            <mui:ModernTab.Links >
                <!-- TODO: set @Source -->
                <mui:Link x:Name="BreedLink" DisplayName="Breeds" Source="/Pages/BreedListV2.xaml" />
                <mui:Link x:Name="SpecieLink" DisplayName="Species" Source="/Pages/SpeciesList.xaml" />
                <mui:Link x:Name="SpecieDetails" DisplayName="Species Details"  />
            </mui:ModernTab.Links>
        </mui:ModernTab>
    </Grid>
</UserControl>

then in code, I got this

private void ModTab_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            SpecieDetails.Source = new Uri("pack://application:,,,/BreedList.xaml", UriKind.Relative);
        }

it says that I got a URI Format Exception. What am I doing wrong?

I wanted to clear the BreedListV2.xaml and replace it with another UserCOntrol but this URI format exception is keeping me in doing this.

Kokombads
  • 450
  • 2
  • 9
  • 23

1 Answers1

1

That's an Absolute Uri not a Relative

Absolute

SpecieDetails.Source = new Uri("pack://application:,,,/BreedList.xaml", UriKind.Absolute);

Relative

SpecieDetails.Source = new Uri("/BreedList.xaml", UriKind.Relative);

Setting your above code to UriKind.Absolute should work fine

sa_ddam213
  • 42,848
  • 7
  • 101
  • 110
  • this still happened =( https://imageshack.com/i/kn4cf60ej I even tried UriKind.AbsoluteOrRelative but still failed – Kokombads Jul 25 '14 at 13:53