using System; using System.Windows; using System.Windows.Media; namespace WpfBaseApp2 { /// /// Interaction logic for MainWindow.xaml /// // public partial class MainWindow : Window /* { public MainWindow() { InitializeComponent(); } } */ public class Start_Up { [STAThread()] static void Main() { Application app = new Application(); Window window = new Window(); Start_Up st = new Start_Up(); window.Height = 300; window.Width = 300; // capaple of receiving resources from other class mySource mys = new mySource(); window.Title = "I am on my Own" + mys.str1; app.MainWindow = window; /* * // window show will fire up and shut * // Run command will keep window alive * // Nested window too needs app.Run() window.Show(); //app.Run(window); */ window.Show(); st.method1(); mys.method1(); app.Run(window); } private void method1() { MessageBox.Show("hello: from private method "); } } public class mySource : Window { public string str1 = " From source"; public void method1() { MessageBox.Show("hello: from mysource public method "); method2(); } private void method2() { MessageBox.Show("hello: from mysource private method "); Window mm = new Window(); mm.Width = 400; mm.Height = 400; mm.Background = Brushes.Azure; mm.Title = "Nested Window "; mm.Show(); } } }