Example #1
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            mainHeader = new Header();
            TextBlock anotherHeaderText = new TextBlock();
            anotherHeaderText.Text = "Layout Tutorial";
            anotherHeaderText.TextAlignment = TextAlignment.Center;
            anotherHeaderText.FontSize = 22;
            mainHeader.Content = anotherHeaderText;
            PlotterMain.Children.Add(mainHeader);

            additioanlHeader = new Header();
            TextBlock headerText = new TextBlock();
            headerText.Text = "Additional header";
            headerText.FontSize = 20;
            headerText.FontWeight = FontWeights.Bold;
            additioanlHeader.Content = headerText;
            PlotterMain.Children.Add(additioanlHeader);

            
            footer = new Footer();
            TextBlock footerText = new TextBlock();
            footerText.Text = "Small footer";
            footerText.FontSize = 8;
            footerText.FontStyle = FontStyles.Italic;
            footer.Content = footerText;

            
            TextBlock vertTitleTextBlock = new TextBlock();
            vertTitleTextBlock.Text = "This is Vertical title";
            //Only VerticalAxisTitle should be created this way, to create HorizonatalAxisTitle use its Content property
            //DO NOT use Content property in VerticalAxisTitle
            vertTitle = new VerticalAxisTitle(vertTitleTextBlock);
            PlotterMain.Children.Add(vertTitle);

            //Use Content property of the HorizontalAxisTitle to set its content
            horiTitle = new HorizontalAxisTitle();
            horiTitle.Content = new TextBlock() { Text="Horizontal axis title set from code",HorizontalAlignment= HorizontalAlignment.Center};
            PlotterMain.Children.Add(horiTitle);

            TextBoxUpperHeaderTitle.Text = anotherHeaderText.Text;
            TextBoxVerticalTitle.Text = vertTitleTextBlock.Text;
        }
        public MainWindow()
        {
            InitializeComponent();

            header = new Header();
            TextBlock headerText = new TextBlock();
            headerText.Text = "Additional header";
            headerText.FontSize = 20;
            headerText.FontWeight = FontWeights.Bold;
            headerText.Foreground = Brushes.DarkBlue;
            header.Content = headerText;

            plotter.Children.Add(header);

            footer = new Footer();
            TextBlock footerText = new TextBlock();
            footerText.Text = "Small footer";
            footerText.FontSize = 8;
            footerText.FontStyle = FontStyles.Italic;
            footerText.Foreground = Brushes.DarkGreen;
            footer.Content = footerText;
        }