我有XAML代码来在框架中创建程序输出。如果我使用" MyFrame.Navigate(typeof(Setup))"我可以更改框架的内容。有没有办法在XAML代码中初始化帧的内容?
XAML代码片段:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Anton" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:900" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="main.css">
<base href="/">
<title> Books </title>
</head>
<body>
<nav class="navbar navbar-inverse bg-inverse navbar-fixed-top">
<div class="container">
<p id="book">BOOKS</p>
</div>
</nav><br><br><br>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card card-1">
<h1> ADD </h1>
</div>
<div class="card card-2">
<h2><i class="material-icons">add_circle</i> ADD </h2>
</div>
</div>
<div class="col-md-4">
<div class="card card-1">
<h1> SEARCH </h1>
</div>
<div class="card card-2">
<div class="block2">
<input class="inner" type="text" placeholder="Enter id"> <button class="btn btn-sm inner" type="button"><span>Search</span></button>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card card-1">
<h1> LIST </h1>
</div><br>
<div *ngFor="let book of books">
<div class="card card-2" (click)="removeBook(book.id)">
<font color="#212121" size="3px"> <b> ID </b> </font> : {{book.id}} <br>
<font color="#212121" size="3px"> <b> NAME </b> </font>: {{book.name}}<br>
<font color="#212121" size="3px"> <b> AUTHOR </b></font>: {{book.author}}
</div>
</div>
</div>
</div>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</html>
感谢您的帮助
答案 0 :(得分:0)
您可以使用SourcePageType
它可以在xaml中设置,代码是
<Frame Name="MyFrame" SourcePageType="Setup"></Frame>
框架将导航至Setup
我认为您在进入页面时可以在框架中使用上面的控件,您可以将其设置为可见性,并且可以在加载完成时隐藏设置。