You must be missing a namespace. You could do something like this:
MainWindow.cs:
using System;
using System.Text;
using System.Windows;
using System.Windows.Controls;
namespace YourNameSpaceHere
{
public partial class MainWindow : Window
{
internal static string message_ = string.Empty;
MainWindow()
{
InitializeComponent();
SetupMessage();
}
private void SetupMessage()
{
message_ = "Hello World!";
}
}
}
OtherFile.cs :
using System;
using System.Text;
using System.Windows;
using System.Windows.Controls; //are you missing this namespace?
namespace YourNameSpaceHere
{
public class Messaging
{
Messaging()
{
MessageBox.Show(MainWindow.message_);
}
}
}
Note that I am using the same namespace in each file and by using the internal keyword the message can be accessed by anything as long as it is in the same namespace. I hope this helps!