Click here to Skip to main content
15,888,047 members
Home / Discussions / C#
   

C#

 
AnswerRe: A Layout Question, And A Bit More Pin
Ennis Ray Lynch, Jr.18-May-12 5:44
Ennis Ray Lynch, Jr.18-May-12 5:44 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright18-May-12 19:50
professionalRoger Wright18-May-12 19:50 
AnswerRe: A Layout Question, And A Bit More Pin
BillWoodruff20-May-12 17:54
professionalBillWoodruff20-May-12 17:54 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright20-May-12 20:34
professionalRoger Wright20-May-12 20:34 
GeneralRe: A Layout Question, And A Bit More Pin
BillWoodruff21-May-12 18:10
professionalBillWoodruff21-May-12 18:10 
GeneralRe: A Layout Question, And A Bit More Pin
BillWoodruff22-May-12 3:47
professionalBillWoodruff22-May-12 3:47 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright23-May-12 20:11
professionalRoger Wright23-May-12 20:11 
AnswerRe: A Layout Question, And A Bit More Pin
Gerry Schmitz21-May-12 13:12
mveGerry Schmitz21-May-12 13:12 
If you are going the WPF route, I would use a UniformGrid to layout your "tiles"; I use it anytime that I need to compose UI's with many similar controls and groupings (usually on-the-fly).

Here's a code-only example that doesn't require XAML source code:

C#
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace CodeOnlyWPF {

   class Program {

      [STAThread]
      static void Main( string[] args ) {

         Window window = new Window() {
            WindowStartupLocation = WindowStartupLocation.CenterScreen,
            SizeToContent = SizeToContent.WidthAndHeight
         };

         UniformGrid ug = new UniformGrid() {
            Columns = 10,
            Rows = 8
         };

         for ( int i = 1; i <= 80; i++ ) {

            Button btn = new Button() {
               Content = i.ToString(),
               Width = 40,
               Height = 40,
               Background = Brushes.GhostWhite
            };

            btn.Click += new RoutedEventHandler( btn_Click );

            ug.Children.Add( btn );

         }  // end for.

         window.Content = ug;

         Application app = new Application();

         app.Run( window );
      }

      static void btn_Click( object sender, RoutedEventArgs e ) {

         Button btn = sender as Button;

         if ( btn.Tag == null ) {
            btn.Background = Brushes.Gold;
            btn.Tag = true;   // Selected.
         }
         else {
            btn.Background = Brushes.GhostWhite;
            btn.Tag = null;   // Not selected.
         }
      }

   }  // end class.

}  // end namespace.

GeneralRe: A Layout Question, And A Bit More Pin
BillWoodruff21-May-12 17:42
professionalBillWoodruff21-May-12 17:42 
GeneralRe: A Layout Question, And A Bit More Pin
Gerry Schmitz21-May-12 21:02
mveGerry Schmitz21-May-12 21:02 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright23-May-12 20:13
professionalRoger Wright23-May-12 20:13 
QuestionRow Not Found Or Changed Pin
Kevin Marois17-May-12 10:10
professionalKevin Marois17-May-12 10:10 
AnswerRe: Row Not Found Or Changed Pin
VJ Reddy17-May-12 21:22
VJ Reddy17-May-12 21:22 
Generalneed help Pin
Kurac117-May-12 9:09
Kurac117-May-12 9:09 
GeneralRe: need help Pin
Pete O'Hanlon17-May-12 9:13
mvePete O'Hanlon17-May-12 9:13 
GeneralRe: need help Pin
Kurac117-May-12 9:16
Kurac117-May-12 9:16 
GeneralRe: need help Pin
Pete O'Hanlon17-May-12 9:22
mvePete O'Hanlon17-May-12 9:22 
AnswerRe: need help Pin
Luc Pattyn17-May-12 11:57
sitebuilderLuc Pattyn17-May-12 11:57 
GeneralRe: need help Pin
fjdiewornncalwe17-May-12 11:16
professionalfjdiewornncalwe17-May-12 11:16 
QuestionNumericUpDown control increment value change Pin
Blubbo17-May-12 7:38
Blubbo17-May-12 7:38 
AnswerRe: NumericUpDown control increment value change Pin
OriginalGriff17-May-12 8:07
mveOriginalGriff17-May-12 8:07 
QuestionCannot Edit or Add Path to Reference File Pin
Xarzu17-May-12 6:47
Xarzu17-May-12 6:47 
AnswerRe: Cannot Edit or Add Path to Reference File Pin
Richard MacCutchan17-May-12 7:00
mveRichard MacCutchan17-May-12 7:00 
GeneralRe: Cannot Edit or Add Path to Reference File Pin
Xarzu17-May-12 7:31
Xarzu17-May-12 7:31 
AnswerRe: Cannot Edit or Add Path to Reference File Pin
Xarzu17-May-12 7:30
Xarzu17-May-12 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.