1
I have the following little problem: I’m creating buttons from the results I find in the data bank. I would just like to position you both accordingly, and when He gets to the end, breaks the line and continues.. I am working on a bar screen, where there are tables. So I would like a help there.
private void geraBotoes()
{
const string strCmd = "SELECT codi_mesa_control, iden_mesa_control FROM titanium
.gourmet_mesa_controle
" +
"WHERE stat_mesa_control is not null AND stat_mesa_control = 'Open';";
var dt = new DataTable("MesasControles");
using (conexao)
{
conexao.Open();
using (var da = new MySqlDataAdapter(strCmd, conexao))
{
da.Fill(dt);
}
conexao.Close();
}
var total = dt.Rows.Count;
if (total > 0)
{
for (var i = 0; i < total; i++)
{
var numMesaControle = dt.Rows[i][0];
var idenMesaControle = dt.Rows[i][1];
var mesaControleButton = new Button {Tag = numMesaControle, Content = idenMesaControle, Margin = new Thickness(10,5,10,5),Height = 50, Width = 100, Name = "Mesa" + numMesaControle, Background = Brushes.DarkGreen, Foreground = Brushes.White};
mesaControleButton.Click += MesaControleButton_Click;
Conteiner.Children.Add(mesaControleButton);
}
//geraMaisBotoes(5);
}
else
{
geraMaisBotoes(10);
}
}
Yes Leandro asked for the answer! I was able to solve my problem. I used Uniformgrid.I did not define sizes for him or buttons, which in case he automatically readjusts to the screen, creating asism, columns and Lines and add the buttons inside. vlw!
– Carlos Mansilha