/// <summary>
        /// Initializes a new instance of the ChildWindowStyleSample class.
        /// </summary>
        public ChildWindowStyleSample()
        {
            InitializeComponent();
            scw                = new StyledChildWindow();
            scw.Closed        += new EventHandler(Scw_Closed);
            thumbs.ItemsSource = from p in Photograph.GetPhotographs()
                                 orderby p.Name
                                 select p;

            thumbs.SelectedIndex = 0;
        }
        /// <summary>
        /// Load the demonstration.
        /// </summary>
        /// <param name="sender">Sample page.</param>
        /// <param name="e">Event arguments.</param>
        private void OnLoad(object sender, RoutedEventArgs e)
        {
            // Don't repopulate if the page has already been loaded.
            if (IsLoaded)
            {
                return;
            }
            IsLoaded = true;

            // Generate the text to wrap
            string lorem = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse sed tellus non sapien laoreet accumsan. Phasellus rhoncus imperdiet pede. Morbi semper ipsum at leo. Nullam elit mi, dignissim et, vestibulum ut, laoreet quis, velit. Nulla aliquet risus sed arcu. Nunc vitae tortor in lectus tristique iaculis. Morbi elit. Quisque euismod mollis orci. Nullam cursus interdum eros. Curabitur tristique mi non nulla. Curabitur non nisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam aliquet, velit eu pretium placerat, massa lorem sollicitudin dolor, non ultricies nisi lorem bibendum enim. Pellentesque mollis egestas ipsum. Donec odio quam, tempus ut, iaculis molestie, viverra vitae, sapien.";

            for (int i = 0; i < 4; i++)
            {
                foreach (string word in lorem.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    ManualTextWrapping.Children.Add(new TextBlock
                    {
                        Text   = word,
                        Margin = new Thickness(3)
                    });
                }
            }

            // Generate the color swatch
            int granularity = 50;

            for (int r = 0; r < 255; r += granularity)
            {
                for (int g = 0; g < 255; g += granularity)
                {
                    for (int b = 0; b < 255; b += granularity)
                    {
                        Swatch.Items.Add(new Rectangle
                        {
                            Width           = 20,
                            Height          = 20,
                            Margin          = new Thickness(5),
                            Stroke          = new SolidColorBrush(Colors.Black),
                            StrokeThickness = 1,
                            Fill            = new SolidColorBrush(Color.FromArgb(255, (byte)r, (byte)g, (byte)b))
                        });
                    }
                }
            }

            // Set the thumbnails
            Thumbnails.ItemsSource = Photograph.GetPhotographs().OrderBy(p => p.Name);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     Initializes a new instance of the Employee class.
 /// </summary>
 /// <param name="firstName">First name of the employee.</param>
 /// <param name="lastName">Last name of the employee.</param>
 /// <param name="resourceName">
 ///     Name of a resource containing a photograph of the employee.
 /// </param>
 internal Employee(string firstName, string lastName, string resourceName) : this(firstName, lastName)
 {
     Photograph = new Photograph(resourceName);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the Employee class.
 /// </summary>
 /// <param name="firstName">First name of the employee.</param>
 /// <param name="lastName">Last name of the employee.</param>
 /// <param name="resourceName">
 /// Name of a resource containing a photograph of the employee.
 /// </param>
 internal Employee(string firstName, string lastName, string resourceName)
     : this(firstName, lastName)
 {
     Photograph = new Photograph(resourceName);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a Page1.
        /// </summary>
        public Page1()
        {
            InitializeComponent();

            DataContext = Photograph.GetPhotographs().First().Image;
        }