user310291
user310291

Reputation: 38228

Silverlight UserControl Inheritance is Buggy compared to WPF?

I have created successfully a wpf user control inheritance like this:

<base:BaseUserControl x:Class="wpfcontrolinheritance.InheritedUserControl"
             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:base="clr-namespace:Base;assembly=Base"
             mc:Ignorable="d" 
             d:DesignHeight="128" d:DesignWidth="238">
    <Grid>
        <Slider Height="23" HorizontalAlignment="Left" Margin="67,52,0,0" Name="slider1" VerticalAlignment="Top" Width="100" />
    </Grid>
</base:BaseUserControl>

I tried to do the same with silverlight but it doesn't work. It says BaseSilverlight cannot be found whereas I did add BaseSilverlight project to references.

<BaseSilverlight:BaseSilverlight x:Class="silverlightcontrolinheritance.inheritedusercontrol"
    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:base="clr-namespace:BaseSilverlight;assembly=BaseSilverlight"
    mc:Ignorable="d"
    d:DesignHeight="149" d:DesignWidth="318">

    <Grid x:Name="LayoutRoot" Background="White">
    </Grid>
</BaseSilverlight:BaseSilverlight>


using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace BaseSilverlight
{
    public class BaseSilverlight
    {

    }
}

Nobody really knows ? I thought this was a basic question.

Upvotes: 0

Views: 314

Answers (1)

AGhosT
AGhosT

Reputation: 123

in line 1 you use BaseSilverlight:BaseSilverlight, but a few lines lower you decalre the namespace as xmlns:base="clr-namespace:BaseSilverlight;assembly=BaseSilverlight.

line1 therefore needs to start base:BaseSilverlight

Upvotes: 1

Related Questions