| Code: |
|
using namespace System; using namespace System::IO; using namespace System::Windows; using namespace System::Windows::Serialization; public ref class LameWindow : public Window { }; public ref class LameApplication : public Application { }; [STAThreadAttribute] int main(array<System::String ^> ^args) { MemoryStream^ ms = gcnew MemoryStream(); StreamWriter^ sw = gcnew StreamWriter(ms); String^ str = "<DockPanel xmlns=\"http://schemas.microsoft.com/winfx/avalon/2005\"> \ <TextBlock Background=\"LightBlue\" DockPanel.Dock=\"Top\">Some Text </TextBlock> \ <TextBlock DockPanel.Dock=\"Bottom\" Background=\"LightYellow\">Some text at the bottom of the page.</TextBlock> \ <TextBlock DockPanel.Dock=\"Left\" Background=\"Lavender\">Some More Text</TextBlock> \ <DockPanel Background=\"Bisque\"> \ <StackPanel DockPanel.Dock=\"Top\"> \ <Button HorizontalAlignment=\"Left\" Height=\"30px\" Width=\"100px\" Margin=\"10,10,10,10\">Button1</Button> \ <Button HorizontalAlignment=\"Left\" Height=\"30px\" Width=\"100px\" Margin=\"10,10,10,10\">Button2</Button> \ </StackPanel> \ <TextBlock Background=\"LightGreen\">Some Text Below the Buttons</TextBlock> \ </DockPanel> \ </DockPanel>"; sw->Write(str); sw->Flush(); ms->Flush(); ms->Position = 0; Window^ window=gcnew LameWindow(); window->Content=(UIElement^)XamlReader::Load(ms); Application^ app=gcnew LameApplication(); app->MainWindow=window; app->MainWindow->Show(); app->Run(); return 0; } |