Bartosz Bartosz
Bartosz Bartosz

Reputation: 41

Already definied InitalizeComponent and ambiguity between _contentLoaded

I got an error about InitalizeComponent() in my c# project in VS2012.

type already defines a member called initializecomponent

I decide to try exclude that part of project and it works. Rest of project was fine. When I added that part of project again InitalizeComponent error hasn't occured, but I got an error about:

ambiguity between _contentLoad and _contentLoad

It's about DeleteCustomerForm, but VS shows that's in DeleteCustomerForm.g.i.cs (what does that g.i. means?). Here is that part of code:

    namespace PropertyManagementPoland.CustomerForms {


/// <summary>
/// MainCustomerForm
/// </summary>
public partial class MainCustomerForm : System.Windows.Window, System.Windows.Markup.IComponentConnector {

    private bool _contentLoaded;

    /// <summary>
    /// InitializeComponent
    /// </summary>
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
    public void InitializeComponent() {
        if (_contentLoaded) {
            return;
        }
        _contentLoaded = true;
        System.Uri resourceLocater = new System.Uri("/PropertyManagementPoland;component/customerforms/deletecustomerform.xaml", System.UriKind.Relative);

        #line 1 "..\..\..\CustomerForms\DeleteCustomerForm.xaml"
        System.Windows.Application.LoadComponent(this, resourceLocater);

        #line default
        #line hidden
    }

    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
    void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
        this._contentLoaded = true;
    }
}

}

I need to finish my project as soon as possible, but I have no idea how to solve that issue. Regards, Bartosz.

Upvotes: 1

Views: 1935

Answers (1)

Bartosz Bartosz
Bartosz Bartosz

Reputation: 41

I found a solution! When I was copping XAML I forget to change x:Class name on one of those forms. Thanks for your time, Chris. Have a nice day.

Upvotes: 3

Related Questions