c# - MyApp.App does not contain a definition for Initialize after adding ResourceDictionary -
everything fine till add resource dictionary. looks like:
app.xaml:
<application x:class="myapp.app" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:myapp.myapp.common"> <application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> </resourcedictionary.mergeddictionaries> <local:mainmenubuttonvisibilityconverter x:key="mainmenubuttonvisibilityconverter" /> <!-- withoot line fine--> </resourcedictionary> </application.resources>
app.g.cs:
namespace myapp { ... public static void main() { myapp.app app = new myapp.app(); app.initializecomponent(); // <------ here problem app.run(); } }
mainmenubuttonvisibilityconverter:
namespace myapp.myapp.common { public class mainmenubuttonvisibilityconverter : ivalueconverter { ... }}
my error:
error 2 'myapp.myapp.app' not contain definition 'initializecomponent' , no extension method 'initializecomponent' accepting first argument of type 'myapp.myapp.app' found (are missing using directive or assembly reference?)
my project name: myapp folder viewmodels , common caled: myapp
what doing incorrectly while adding resource dictionary?
app.xaml.cs
namespace myapp.myapp { public partial class app : application { private shell shell; private myappmain myappmain; public app() { } private void dispatcher_unhandledexception(object sender, dispatcherunhandledexceptioneventargs e) { messagebox.show(e.exception.message, "", messageboxbutton.ok, messageboximage.hand); e.handled = true; } protected override void onstartup(startupeventargs e) { base.onstartup(e); base.dispatcher.unhandledexception += new dispatcherunhandledexceptioneventhandler(this.dispatcher_unhandledexception); myappmain = new myappmain(""); } }}
have tried change order of declarations ? converters should declared @ first in resourcedictionary.
<resourcedictionary> <local:mainmenubuttonvisibilityconverter x:key="mainmenubuttonvisibilityconverter" /> <!-- withoot line fine--> <resourcedictionary.mergeddictionaries> </resourcedictionary.mergeddictionaries> </resourcedictionary>
Comments
Post a Comment