Pradeep Singh
Pradeep Singh

Reputation: 243

Setting Grid.ColumnSpan for Button in ItemsSource

I have Grid that has some buttons and I need to arrange the order of the button according to the config file. Below is my Button class where I set the properties of the button. Is there any way to set the Grid.ColumnsSpan for these buttons?

    public class ButtonModel
   {
     public int Index { get; set; }
     public string Content { get; set; }
     public ImageSource Image { get; set; }
     public ICommand Command { get; set; }
   }

Upvotes: 0

Views: 115

Answers (1)

Nitin Purohit
Nitin Purohit

Reputation: 18578

If your Button model has information regarding what should be columnspan for its button.. then you can directly bind the Grid.Column span in xaml to it...

<Button Grid.ColumnSpan="{Binding ColumnSpan}"/> assuming buttonmodel has property ColumnSpan..which you initialized from your configuration..

Upvotes: 1

Related Questions