TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
MCC KWC
NA
1
613
How to dynamically arrange buttons in Windows phone 8 app
Sep 4 2015 3:07 AM
Here is my code............
int i = 0; int j = 0;
int button_number = 1;
foreach (var element in jsonObj.ds.Table)
{
depot_collection.Add(element.depot);
Button btn = new Button();
btn.Height = 160;
btn.Width = 160;
btn.Content = element.terr;
btn.Background = new SolidColorBrush(Colors.Blue);
btn.Foreground = new SolidColorBrush(Colors.White);
btn.BorderBrush = new SolidColorBrush(Colors.Blue);
btn.Margin = new Thickness(-300 + (j * 290), 200 + (i * 290), 0, 0);//- (extra_row * 275),
LayoutRoot.Children.Add(btn);
if (button_number % 3 == 0)
{
i++;
j = 0;
}
else
{
j++;
}
button_number++;
}
Am I forward on right way? or have there any better concept to do this?
Reply
Answers (
1
)
how to pass datasource to gridview using loop and condition
how can we use datatable for insert multiple row