public void LoadTiles() { bool hasLabels = LabelsList != null; int labelCounter = 0; int enabledCounter = 0; int resourcePathListCounter = 0; int actionsCounter = 0; for (int r = 0; r < Rows; r++) { for (int c = 0; c < Columns; c++) { TiltTile tt = new TiltTile() { Width = TileWidth, Height = TileHeight }; tt.SetValue(Canvas.LeftProperty, (c * (TileWidth + 5)) + 5); tt.SetValue(Canvas.TopProperty, (r * (TileHeight + 5)) + 5); tt.NormalBackground = NormalTileBackground; tt.SelectedBackground = SelectedTileBackground; tt.DisabledBackground = DisabledTileBackground; tt.ClickMessengerIdentifier = ClickIdentifier; tt.ClickMessengerAggregateId = ClickAggregateId; if (ActionsList != null && ActionsList.Count > actionsCounter) { tt.ClickMessengerAction = (string)ActionsList[actionsCounter]; actionsCounter++; } tt.ClickAction = ClickAction; tt.PointerReleasedHandled = true; if (hasLabels && LabelsList.Count > labelCounter) { tt.LabelFontSize = 12; tt.Label = (string)LabelsList[labelCounter]; labelCounter++; } if (EnabledList != null && EnabledList.Count > enabledCounter) { tt.IsDisabled = (bool)EnabledList[enabledCounter]; enabledCounter++; } if (ResourcePathList != null && ResourcePathList.Count > resourcePathListCounter) { tt.LoadPathIcon((string)ResourcePathList[resourcePathListCounter]); resourcePathListCounter++; } //tt.Label = Labels[r, c]; //unfortunately this isnt initialized at this point mainCanvas.Children.Add(tt); } } IsTilesHidden = false; }
public void LoadTiles() { bool hasLabels = LabelsList != null; int labelCounter = 0; int enabledCounter = 0; int resourcePathListCounter = 0; int actionsCounter = 0; for (int r = 0; r < Rows; r++) { for (int c = 0; c < Columns; c++) { TiltTile tt = new TiltTile() { Width = TileWidth, Height = TileHeight }; tt.SetValue(Canvas.LeftProperty, (c * (TileWidth + 5)) + 5); tt.SetValue(Canvas.TopProperty, (r * (TileHeight + 5)) + 5); tt.NormalBackground = NormalTileBackground; tt.SelectedBackground = SelectedTileBackground; tt.DisabledBackground = DisabledTileBackground; tt.ClickMessengerIdentifier = ClickIdentifier; tt.ClickMessengerAggregateId = ClickAggregateId; if (ActionsList != null && ActionsList.Count > actionsCounter) { tt.ClickMessengerAction = (string)ActionsList[actionsCounter]; actionsCounter++; } tt.ClickAction = ClickAction; tt.PointerReleasedHandled = true; if (hasLabels && LabelsList.Count > labelCounter) { tt.LabelFontSize = 12; tt.Label = (string)LabelsList[labelCounter]; labelCounter++; } if (EnabledList != null && EnabledList.Count > enabledCounter) { tt.IsDisabled = (bool)EnabledList[enabledCounter]; enabledCounter++; } if (ResourcePathList != null && ResourcePathList.Count > resourcePathListCounter) { tt.LoadPathIcon( (string)ResourcePathList[resourcePathListCounter] ); resourcePathListCounter++; } //tt.Label = Labels[r, c]; //unfortunately this isnt initialized at this point mainCanvas.Children.Add(tt); } } IsTilesHidden = false; }