Forum Xamarin.Forms

Show Border in Grid (Xaml)

BuiManhBuiManh USMember ✭✭

I have problem with showing Border of grid in xaml.
I have Xaml page like this:

                                <?xml version="1.0" encoding="utf-8" ?>
                                <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                                             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                                             x:Class="DAC_Check.Views.HistoryPage" BackgroundColor="White">

                                  <ContentPage.Content >
                                    <ListView    CachingStrategy="RecycleElement"
                                           SeparatorColor="Transparent"
                                           HasUnevenRows="True"
                                           x:Name="ListViewNews">
                                      <ListView.ItemTemplate>
                                        <DataTemplate>
                                          <ViewCell>
                                            **<Border BorderBrush="Black" BorderThickness="2">**
                                              <Grid ShowGridLines="True" Padding="3">
                                                <Grid.ColumnDefinitions>
                                                  <ColumnDefinition Width="55"/>
                                                  <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>

                                                <Image Source="{Binding IMG}" VerticalOptions="Center">
                                                  <Image.WidthRequest>
                                                    <OnPlatform x:TypeArguments="x:Double">
                                                      <OnPlatform.iOS>55</OnPlatform.iOS>
                                                      <OnPlatform.Android>55 </OnPlatform.Android>
                                                      <OnPlatform.WinPhone>75</OnPlatform.WinPhone>
                                                    </OnPlatform>
                                                  </Image.WidthRequest>
                                                  <Image.HeightRequest>
                                                    <OnPlatform x:TypeArguments="x:Double">
                                                      <OnPlatform.iOS>50</OnPlatform.iOS>
                                                      <OnPlatform.Android>50</OnPlatform.Android>
                                                      <OnPlatform.WinPhone>65</OnPlatform.WinPhone>
                                                    </OnPlatform>
                                                  </Image.HeightRequest>
                                                </Image>
                                                <StackLayout Grid.Column="1"
                                                             Padding="4"
                                                             Spacing="4"
                                                             VerticalOptions="Center">
                                                  <Label Text="{Binding Title}" Font="Bold,13" TextColor="Black" />
                                                  <Label Text="{Binding PublicDate}" x:Name="lbDate" FontSize="Small" LineBreakMode="WordWrap"/>
                                                  <Label/>
                                                </StackLayout>
                                              </Grid>
                                            </Border>
                                          </ViewCell>
                                        </DataTemplate>
                                      </ListView.ItemTemplate>
                                    </ListView>
                                  </ContentPage.Content>
                                </ContentPage>

When run it, the debug show that:

Xamarin.Forms.Xaml.XamlParseException: Position 14:14. Type Border not found in xmlns http://xamarin.com/schemas/2014/forms

How can i fix that???

Answers

  • Glorious18Glorious18 Member ✭✭✭

    how to use frame in a grid?
    please can you show me a code sample for xaml?

  • JohnHardmanJohnHardman GBUniversity admin

    @Glorious18 said:
    how to use frame in a grid?
    please can you show me a code sample for xaml?

    As per the forum rules and guidelines at https://forums.xamarin.com/discussion/87290/xamarin-forum-rules-and-guidelines#latest , please do not re-awaken old posts.

    The forum rules and guidelines say
    "Successful Contributors Will Not:" ... "Comment on old posts: It's preferred to post a new question/discussion and include a link if there is relevant information you want to share when a topic is older than 6 months."

    Please post a new question as a new forum thread.
    I suggest including a diagram of what you are trying to achieve, to clarify whether a Frame is required (and if so, whether the Grid goes in the Frame, or the Frame goes in the Grid), or whether Padding or Margin will suffice.

Sign In or Register to comment.