如何在内容页面中添加内容视图下面是我的内容页面。在此页面中,如何包含内容视图

时间:2018-12-13 17:02:49

标签: c# xamarin.forms

**this my contentview. xaml created saparatly

<?xml version="1.0" encoding="utf-8" ?>

<ContentView.Content>

<Grid.RowDefinitions>

</Grid.RowDefinitions>

            <Grid Grid.Row="0" Margin="0, 50" VerticalOptions="Center">
                <Image Source="location_guy" 
                   Style="{StaticResource OnboardingIconStyle}"/>
            </Grid>
        <StackLayout Grid.Row="1" VerticalOptions="Center" Padding="30,0">
            <Label Text="Not Available..." Style="{DynamicResource MapTitleStyle}" />
            <Label Text="Sorry, this feature is currently not available for this location"
                   Style="{DynamicResource MapTitleTextStyle}"
                   Margin="0,15,0,15" />
        </StackLayout>
    <Grid Grid.Row="2" Margin="20,50" VerticalOptions="Center">
        <Button  Text="See my site info"
                           Style="{DynamicResource MapTitleTextStyle}"
                           Command="{Binding ReportWorkspaceIssueCommand}"
                           Margin="0,40,0,0"
                           HorizontalOptions="FillAndExpand"/>
        <Label Grid.Column="4" 
                          Text="Change my location"
                          Margin="10,10,0,10"
                          Style="{DynamicResource MapTitleTextStyle}"
                          HorizontalOptions="CenterAndExpand"/>

    </Grid>
</Grid>
</ContentView.Content>`

above is my contentview page
below code is initialize the contentview code...
using Aria.Helpers;
using Aria.Managers;
using Aria.Services;
using Aria.ViewModels;
using Common.Helpers;
using Common.Services;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Aria.Pages.Map
{
public partial class MapNotAvailableView : ContentView
{     
    public MapNotAvailableView ()
    {
        InitializeComponent ();

    }
}

how to add content view in content page below is my content page .in this page how to include content view .

<?xml version="1.0" encoding="utf-8" ?>
<common:BaseContentPage x:TypeArguments="viewModels:MapPageViewModel"
xmlns:viewModels="clr-namespace:Aria.ViewModels"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

         xmlns:cviews="clr-namespace:Aria.Views"                     
         xmlns:common="clr-namespace:Aria.Pages.Common"
                    xmlns:local="clr-namespace:Aria.Pages.Map"
                    x:Class="Aria.Pages.Home.MapPage"
         Title="Spaces"
         Icon="space.png"
         BackgroundColor="{DynamicResource BackgroundColor}">

<RelativeLayout  x:Name="MapViewdata">

    <cviews:MapWebView
        x:Name="mapView" 
        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" 
        RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" 
        AutomationId="cnvsVwMap"/>

    <cviews:MapFilterView 
        x:Name="mapFilterView"
        BackgroundColor="Transparent"
        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" 
        RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1, Constant=-50}"
        RelativeLayout.XConstraint="{Constraint Expression Type=RelativeToParent, Property=X, Factor=1, Constant=0}" />

 请提供上述代码的解决方案,如何将内容视图添加到内容页面**

为上述代码提供解决方案...................................... ................................................... .............. ................................................... .............. ................................................... ...

0 个答案:

没有答案