Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Grid rows and Colums

$
0
0

Hi,

I have a ListView.ItemTemplate with a Grid in it.

I want the Label with the Binding Name over the whole first row and in the second row I want the Picker and the Labels with the bindings a,b in seperated Columns. But the first column of the second row has always the same width as column in the first row.
Can anyone tell me how to fix this?

This is my Code:

`
<ListView.ItemTemplate>

        <Grid Padding="5">
          <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"></ColumnDefinition>
            <ColumnDefinition Width="100"></ColumnDefinition>
            <ColumnDefinition Width="100"></ColumnDefinition>
          </Grid.ColumnDefinitions>

          <Label Grid.Row="0" Grid.Column="0" Text="{Binding Name}" TextColor="White" FontSize="Small" LineBreakMode="NoWrap"></Label>

          <Picker Grid.Row="1" Grid.Column="0" Scale="0.8" VerticalOptions="Center" HorizontalOptions="Start" WidthRequest="100" SelectedIndex="{Binding Status}" SelectedIndexChanged="Picker_OnSelectedIndexChanged_Status">
            <Picker.Items>
              <x:String>item1</x:String>
              <x:String>item2</x:String>
              <x:String>item3</x:String>
            </Picker.Items>
          </Picker>

          <Label Grid.Row="1" Grid.Column="0" Text="{Binding a}" VerticalOptions="Center" HorizontalOptions="End" TextColor="White" LineBreakMode="NoWrap"></Label>


          <Label Grid.Row="1" Grid.Column="1" Text="{Binding b}" VerticalOptions="Center" HorizontalOptions="Center" TextColor="White" LineBreakMode="NoWrap"></Label>

          <Label Grid.Row="1" Grid.Column="2" Text="{Binding c}" VerticalOptions="Center" HorizontalOptions="Start" TextColor="White" LineBreakMode="TailTruncation"></Label>

        </Grid>
      </ViewCell>
    </DataTemplate>
  </ListView.ItemTemplate>

`

Thanks in Advance


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>