bloodfire1004
bloodfire1004

Reputation: 503

How to use WrapGrid Orientation?

I am fairly new to XAML / WPF programming. I would like to ask how to do a particular line of code from XAML into C#?

XAML:

<GridView>
  <ItemsPanelTemplate>
    <WrapGrid Orientation="Horizontal"/>
  </ItemsPanelTemplate>
</GridView>

How can I do this in C#?

Upvotes: 0

Views: 1408

Answers (1)

Eirik
Eirik

Reputation: 4205

If you give the control a name, like this:

<GridView>
  <ItemsPanelTemplate>
    <WrapGrid Name="MyWrapGrid" Orientation="Horizontal"/>
  </ItemsPanelTemplate>
</GridView>

You can do this in code behind (C#) to change the orientation:

MyWrapGrid.Orientation = Orientation.Horizontal;

Upvotes: 3

Related Questions