Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8196911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:37:33+00:00 2026-06-07T05:37:33+00:00

Since the xaml window stopped showing my wpf form using VS 2012 (after I

  • 0

Since the xaml window stopped showing my wpf form using VS 2012 (after I added some comments to the top of the main .cs form), I reverted back to C# Express 2010.

I copied my xaml and code and pasted them into the new project.

However, I’m getting err msgs such as:

*’duckbilledPlatypusInfoMailer_Express.MainWindow’ does not contain a definition for ‘MainWindow_Loaded’ and no extension method ‘MainWindow_Loaded’ accepting a first argument of type ‘duckbilledPlatypusInfoMailer_Express.MainWindow’ could be found (are you missing a using directive or an assembly reference?)*

and:

The name ‘InitializeComponent’ does not exist in the current context

I get the same err msg about two controls, my label and button (but not the DatePicker!)

So both of my event handlers, and two of my three controls, as well as the ‘InitializeComponent’ have been rendered in a cloak of invisibility, as far as VC#2010 is concerned…???

Here is my xaml and code (minimal, so p[a,o]sting all of it):

XAML:

<Window x:Class="duckbilledPlatypusInfoMailer_Express.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Duckbilled Platypus Info Mailer"  SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" MinHeight="350" MinWidth="525" Loaded="MainWindow_Loaded" >
    <StackPanel>
        <StackPanel Orientation="Horizontal">
            <Button x:Name="btnSelectPDFFile" HorizontalAlignment="Left" Padding="4" Margin="4" Width="120" Click="btnSelectPDFFile_Click" IsDefault="True">Select PDF File
            </Button>
            <Label x:Name="lblPlatypusSheetFile" Margin="4" >[Selected File]</Label>
        </StackPanel>
        <StackPanel Orientation="Horizontal">
            <DatePicker ></DatePicker>
        </StackPanel>
    </StackPanel>
</Window>

CODE:

using System;
using System.Windows;
using duckbilledPlatypusInfoMailer;

namespace PlatypusInfo_Express
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            btnSelectPDFFile.Focus();
        }

        private void btnSelectPDFFile_Click(object sender, RoutedEventArgs e)
        {
                        var dlg = new Microsoft.Win32.OpenFileDialog
                          {
                              InitialDirectory = @"C:\Scrooge\McDuckbilledPlatypus\",
                              DefaultExt = ".pdf",
                              Filter = "Platypus Data Sheets (sa*.pdf)|sa*.pdf"
                          };

            bool? result = dlg.ShowDialog();

            if (result == true)
            {
                string pdfFilename = dlg.FileName;
                // Show just the file name, without the path
                string pdfFileNameOnly = System.IO.Path.GetFileName(pdfFilename);
                lblReviewSheetFile.Content = pdfFileNameOnly;
                string textFilename = String.Format(@"C:\Scrooge\McDuckbilledPlatypus\{0}.txt", pdfFileNameOnly);
                var pdfParser = new PDFParser();
                if (pdfParser.ExtractText(pdfFilename, textFilename))
                {
                    System.Diagnostics.Process.Start(textFilename);
                }
                else
                {
                    MessageBox.Show("There was a boo-boo, Yogi!");
                }
            }
        }
    }
}

BTW, I did add the necessary 3rd party file to my solution (PDFParser.cs) as well as the two necessary references.

Note: If I right-click the event handlers in the xaml, it DOES take me to those event handlers in the cs file. So it knows where they are, why does it say they don’t exist or it can’t find them?

UPDATE

Here’s the first part of the error I see in the WPF designer:

System.NotSupportedException
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal)
at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle1 targetObject, Action action)
at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle
1 targetObject, Func`2 func)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:37:34+00:00Added an answer on June 7, 2026 at 5:37 am

    There is an extra duckbilled in the namespace in the XAML :

    <Window x:Class="duckbilledPlatypusInfoMailer_Express.MainWindow"
    

    it has to be in the same namespace as to code behind class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a 630 x 400 Window, I'm loading there XAML elements: menu at top
In my MainWindow.xaml, I have added my UserControl to the Window. There is also
In a WPF Application using XAML, I have 2 images, which needs to be
OK I'm redoing this since I messed it up. :) here's the xaml. <Window
When the following XAML used, the window size is not 5000x5000, but some small
Since Intellij does not yet support the Play-Scala-Template-Engine I was thinking about using plain
I have the following line in my Window stanza in the XAML file: Closing=Window_Closing
I've implemented a simple WPF splash screen window which informs the user about the
I have an ObjectDataProvider in my XAML that references a method in my Window
I've been working on a WPF application. Since I design the UI in Expression

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.