I have multiple xaml pages that have common functionality and I need to create a single .cs file to use them. So I commented all the code in my .cs for the .xaml and created a new .cs file to handle my "Test" page's functionality.
I followed the answer here but I'm getting the error:
"The name 'InitializeComponent' does not exist in the current context "
as well as:
The type 'local:MainCode' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Here's what I did:
In my .xaml page:
<**local:MainCode** x:Class="SilverlightApp1.Common.Test"
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"
mc:Ignorable="d"
**xmlns:local="clr-namespace:SilverlightApp1.Common**"
And in my code page:
namespace SilverlightApp1.Common {
public class MainCode: UserControl { public MainCode() { } public partial class Test: MainCode { public Test() { InitializeComponent(); } } } }
Can you help point me to the problem ?