Compile Error for WPF Files: The name 'InitializeComponent' does not exist in the current context

by Markus 17. December 2010 01:04

 

Solution is described here

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/2f755d30-bd8c-4f9b-b36a-9cb56bea15cd/

 

The initializeComponent routine is created in the .g.cs file that is created during build.  (see obj\debug\...)

Make sure your XAML file has a build action of "Page" to create that file.

Also, make sure that the partial classes in .xaml.cs and .g.cs match.

Hope that helps.

Thanks, Rob Relyea
WPF Team

 

< Back

Tags:

Beitrag aus Word

by Markus 25. November 2010 23:04

Ein super Beitrag aus Word.

Tags:

Merge WPF Assemblies

by Markus 12. May 2010 18:42

ilMerge, a Microsoft Tool for merging Assemblies, is not working for merging WPF Assemblies. But Richard Dingwall had a very good idea (see here)

 

There was one Problem with the code for me (see Comments). When referencing Styles or Resources in the App.xaml the OnStartup Event is called to late. The Resources are needed before OnStartup. So Richard suggested to register the handler in the Constructor of the App Class, and this is working like a charm!

Here is some sample Code to Download. Use it as you want without any warranty…

 

The important part of the Code looks like this now:

 

public partial class App : Application {
        public App() {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssembly);
        }

        static Assembly ResolveAssembly(object sender, ResolveEventArgs args) {
            //We dont' care about System Assembies and so on...
            if (!args.Name.ToLower().StartsWith("clever")) return null;

            Assembly thisAssembly = Assembly.GetExecutingAssembly();
            //Get the Name of the AssemblyFile
            var name = args.Name.Substring(0, args.Name.IndexOf(',')) + ".dll";

            //Load form Embedded Resources - This Function is not called if the Assembly is in the Application Folder
            var resources = thisAssembly.GetManifestResourceNames().Where(s => s.EndsWith(name));
            if (resources.Count() > 0) {
                var resourceName = resources.First();
                using (Stream stream = thisAssembly.GetManifestResourceStream(resourceName)) {
                    if (stream == null) return null;
                    var block = new byte[stream.Length];
                    stream.Read(block, 0, block.Length);
                    return Assembly.Load(block);
                }
            }
            return null;
        }

    }

 

< Back to Content

Tags:

Web Traffic Debugging with Fiddler

by Markus 25. March 2010 20:09

Web Traffic Debugging with Fiddler

 

Step 1

Download Fiddler from http://www.fiddlertool.com

 

Step 2

Configure Fiddler to work with Visual Studio Development Server.

  • Set your Web Project to use a Fixed Port like 10000 (Under VS - Project – Properties – Web)
  • Start Fiddler and aktivate to Capture the Traffic (Under Fiddler – File – Capture Traffic)
  • Insert the following script in function OnBeforeRequest in the Fiddler Custom Rules (Under Fiddler – Rules – Customize Rules)

  if (oSession.host=="name:10000"){
   oSession.host="127.0.0.1:10000";
  }

  • Start the debugging session in your VS. Change the Browsers address line from
    • localhost:10000 to
    • name:10000
  • From now on Fiddler is showing you all traffic
  • Click in Fiddler on View – Inspector and use the Tabs of the inspector to see the complete traffic.

Here you see also detailed Error Messages if a Service you called from Silverlight is failing…

 

< Back to Content

Tags:

Silverlight Deployment: InitializeError

by Markus 25. March 2010 19:50

 

Silverlight Deployment: InitializeError

(in german)

Fehler: Unhandled Error in Silverlight Application
Code: 2104
Category: InitializeError
Message: Die Silverlight-Anwendung konnte nicht heruntergeladen werden.
Überprüfen Sie die Webservereinstellungen.

 

Step1:

Check if the Path in the Page referencing the Silverlight Applications is correct. Use Fiddler to debug the traffic and error messages if you are not sure if the path is correct.

 

Step2:

Check if the MINME Types for your Silverlight applications are registered in the IIS. You can check this in IIS6 under Properties of the Server and under IIS7 under Mime Types.

 

< Back to Content

Tags:

TextBlock TextWrapping in ListBoxItem

by Markus 26. January 2010 18:26

TextBlock TextWrapping in ListBoxItem

 

If you have a ListBox and and you want to stretch the ListBox Items to fit exactly the width of the Textbox you have to Edit the Template for the Listbox and set the HorizontalContentAlignment for the ListBox Items to Stretch.

 

Now, if you have a TextBlock in a Listbox Item and the Text is longer than the Width of the Listbox but you don’t want the Listbox Item to extend its width but to wrap the Text you will have to set the HorizontalScrollbar to disabled.

 

< Back to Content

Tags:

Error Message during Compile: File or Files has invalid value "<<<<<<< .mine". Illegal characters in path

by Markus 26. January 2010 18:21

Error Message during Compile: File or Files has invalid value "<<<<<<< .mine". Illegal characters in path

 

That is something that SVN inserts into a file when it tries to merge its version of a file.

Simplest thing to resolve this which i tried doing was  ...

remove any characters "<<<<<<< .mine" or  similar from the file that you will see in your project object  folder namely

<Projectname>.csproj.FileListAbsolute.txt

which contains a list of all the paths and recompile ...it worked for me

You may should read more at
http://tortoisesvn.tigris.org/faq.html

 

< Back to Content

Tags:

Test

by Markus 30. December 2009 22:27

Tags:

Namespace Appname.Web.Resources not Found in New Silverlight RIA Project

by Markus 18. December 2009 01:59

Namespace Appname.Web.Resources not Found in New Silverlight RIA Project

 

Problem: You have a Working Silverlight RIA Application. Now You want to add a second new Silverlight Application. After doing this you will get the Complier Error:

error CS0234: The type or namespace name 'Resources' does not exist in the namespace 'Appname.Web'

The Problem is, that you have to add some Resource Files manually!

In the First Silverlight Project you have the folder Web/Resources and their are some files.

 

Solution:

Create the Folder Web/Resources in the New Silverlight project and Link the same Files as in the first Silverlight project.

 

< Back to Content

Tags:

Transitions

by Markus 14. December 2009 20:31

Transitions

Out their are some real good transitions frameworks, but almost all of them are really hard to understand for a normal developer. So I wrote some easy functions doing the work, understandable for every Silverlight developper…

 

The sample code can be downloaded here:

 

(Coming soon…)

Tags:

About MaHop.Net

Just look on our Webpage http://www.mahop.net

Tag cloud