Reputation: 75
I'm adding keyboard to my bot by using InlineKeyboardMarkup. In code below: all buttons are shown in 1 line. How can I achieve that 1 button will be shown per a 1 line?
Thanks for your time.
var mainKeyBoard = new InlineKeyboardMarkup(new[]
{
InlineKeyboardButton.WithCallbackData("beer"), InlineKeyboardButton.WithCallbackData("price"),
InlineKeyboardButton.WithCallbackData("support")
});
Upvotes: 0
Views: 2174
Reputation: 75
Figured it out. New row requires new array into array. For my sample above it work like this:
static InlineKeyboardMarkup mainKeyBoard = new InlineKeyboardMarkup(new[] {
new[]
{
InlineKeyboardButton.WithCallbackData("beer")
},
new[]
{
InlineKeyboardButton.WithCallbackData("price"),
},
new[]
{
InlineKeyboardButton.WithCallbackData("support")
}
});
Upvotes: 3