我知道你可以这样在XAML中用"*"设置行高:
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
Run Code Online (Sandbox Code Playgroud)
但是C#中的相同表达式返回错误:
new RowDefinition { Height = new GridLength("*", GridUnitType.Auto) },
Run Code Online (Sandbox Code Playgroud)
所以我的问题是如何在C#中将网格的行高设置为"*"?
是否有一种简单的方法可以隐藏ListView中的滚动条,但仍然可以滚动它?
我有以下网格,它被加载到StackLayout中:
Grid grid = new Grid {
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
RowDefinitions =
{
new RowDefinition { Height = new GridLength(40, GridUnitType.Auto) },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = new GridLength(40, GridUnitType.Auto) },
},
ColumnDefinitions =
{ …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个带有便携式类库的Android/iOS xamarin表单应用程序.我正在寻找在PCL项目中执行此示例的最佳方法:
https://msdn.microsoft.com/en-us/library/456dfw4f(v=vs.110).aspx
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main ()
{
// Create a request for the URL.
WebRequest request = WebRequest.Create (
"http://www.contoso.com/default.html");
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
WebResponse response = request.GetResponse ();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open …
Run Code Online (Sandbox Code Playgroud) httpwebrequest portable-class-library dotnet-httpclient xamarin xamarin.forms
我有以下内容页面,我想在其中加载Steema Teechart,但我不能,因为我不能使MainPage异步:
我的主页:
public class MainPage : ContentPage
{
public MainPage (bool chart)
{
ChartView chartView = new ChartView
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
HeightRequest = 300,
WidthRequest = 400
};
LineModel test1 = new LineModel();
chartView.Model = await test1.GetModel();
//put the chartView in a grid and other stuff
Content = new StackLayout {
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Children = {
grid
}
};
}
}
Run Code Online (Sandbox Code Playgroud)
我的LineModel类:
public class LineModel
{
public async Task<Steema.TeeChart.Chart> GetModel () …
Run Code Online (Sandbox Code Playgroud) 我需要创建一个弹出窗口,其中会有一些选项卡,每个选项卡都包含一个列表视图。我知道有一个 TabbedPage,但我需要一个“TabbedView”以便我可以使用 Xlabs PopupLayout 构建我的弹出窗口。如何在 Xamarin Forms 中执行此操作?