WPF C# Tutorial

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="CodeMapNS"
    x:Class="ContentControlSimple.Page1">
    
        
            
                
                
                
                
                    
                        
                            
                                
                                                                    HorizontalAlignment="Center"/>
                            

                        
                    

                
            
            
                
            
        

        
            
        
                   Background="Blue">
                      Content="This is the content of the content control."/>
        
        
            Click 
        
    


//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media;
using System.Collections.ObjectModel;
namespace ContentControlSimple
{
    public partial class Page1 : Canvas
    {
        void OnClick(object sender, RoutedEventArgs e)
        {
            if (contCtrl.HasContent == true)
            {
                MessageBox.Show("contCtrl has content");
            }
        }
    }
}