我想要左侧的ToolbarItem Menu1,但此时两者都在右侧.我该如何解决这个问题?
<?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="Dharma.LoginPage">
<ContentPage.ToolbarItems>
<ToolbarItem Name="Menu1" Order="Primary" Priority="0" />
<ToolbarItem Name="Menu2" Order="Primary" Priority="1" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<StackLayout Padding="30">
<Label Text="Login Page" FontSize="20" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Run Code Online (Sandbox Code Playgroud) 绑定不适用于Image标记.当我调试时,我看到Extension类中的Source值始终为null?但标签的内容不是空的.
<Label Text="{Binding Image}" />
<Image Source="{classes:ImageResource Source={Binding Image}}" />
Run Code Online (Sandbox Code Playgroud)
// You exclude the 'Extension' suffix when using in Xaml markup
[Preserve(AllMembers = true)]
[ContentProperty("Source")]
public class ImageResourceExtension : BindableObject, IMarkupExtension
{
public static readonly BindableProperty SourceProperty = BindableProperty.Create(nameof(Source), typeof(string), typeof(string), null);
public string Source
{
get { return (string)GetValue(SourceProperty); }
set { SetValue(SourceProperty, value); }
}
public object ProvideValue(IServiceProvider serviceProvider)
{
if (Source == null)
return null;
// Do your translation lookup here, using whatever method you …Run Code Online (Sandbox Code Playgroud) <?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="Dh.ListPage">
<ContentPage.Content>
<ScrollView>
<StackLayout Style="{StaticResource MainStackLayoutWhenLoggedInStyle}">
<Frame Style="{StaticResource FrameStyle2}">
<StackLayout>
<Label Text="Vragenlijsten" Style="{StaticResource TitelLabelStyle}" />
</StackLayout>
</Frame>
<Frame Style="{StaticResource FrameStyle2}">
<StackLayout>
<Label Text="DRINGENDE VRAGEN: vul deze vragen meteen in!" Style="{StaticResource StandardLabelStyle}"/>
<Frame Style="{StaticResource FrameStyle2}">
<StackLayout Style="{StaticResource ListViewStackLayoutStyle}" >
<ListView ItemTapped="OnItemTapped" ItemsSource="{Binding Question_Lists}" Style="{StaticResource StandardListViewStyle}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Label Text="{Binding Title}" Style="{StaticResource StandardLabelStyle}" />
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
</ContentPage.Content>
Run Code Online (Sandbox Code Playgroud)
当我的屏幕太小时,我的列表视图不想滚动.如果我的屏幕不是太小,那么listview会滚动.有人可以帮我吗?
Android没有这个问题,但是当我在iOS中运行相同的工作代码时,我会遇到异常
public async Task Login(string inlogData, string password, string gcm)
{
Login login = new Dharma.Login ();
login.inlog_data = inlogData;
login.password = password;
login.phone_token = gcm;
HttpClient client = new HttpClient ();
HttpResponseMessage response = null;
string json = JsonConvert.SerializeObject(login, Formatting.Indented);
client.Timeout = TimeSpan.FromMilliseconds (10000);
client.BaseAddress = new Uri (ConstantVariabels.GetLoginUrl());
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var content = new StringContent (json, Encoding.UTF8, "application/json");
try
{
response = await client.PostAsync (client.BaseAddress, content);
response.EnsureSuccessStatusCode ();
var JsonResult = response.Content.ReadAsStringAsync ().Result;
dynamic dynJson = JsonConvert.DeserializeObject(JsonResult);
string …Run Code Online (Sandbox Code Playgroud)