小编Gui*_*rin的帖子

Xamarin - 清除ListView选择

我实际上正在使用这段代码

using System;
using Xamarin.Forms;
using System.Diagnostics;

namespace CryptoUI
{
    public class HomePage : Xamarin.Forms.MasterDetailPage
    {
        public HomePage()
        {
        // Set up the Master, i.e. the Menu
            Label header = new Label
            {
                Text = "MENU",
                Font = Font.SystemFontOfSize(20, FontAttributes.Bold),
                HorizontalOptions = LayoutOptions.Center
            };
        // create an array of the Page names
        string[] myPageNames = {
            "Main",
            "Page 2",
            "Page 3",
        };

        // Create ListView for the Master page.
        ListView listView = new ListView
        {
            ItemsSource = myPageNames,
        };

        // …
Run Code Online (Sandbox Code Playgroud)

c# listview xamarin xamarin-studio xamarin.forms

8
推荐指数
2
解决办法
1万
查看次数

Xamarin表单listview数据绑定

我目前正在遵循本指南:

http://www.morganskinner.com/2015/01/xamarin-forms-contacts-search.html

我愿意在我的应用程序中创建一个联系人页面,就像那里的图片中显示的一样,仍然有些东西不适合我:

我写了/复制了XAML:

    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <SearchBar x:Name="search" Placeholder="Search"/>

    <ListView x:Name="ProvaView" Grid.Row="1" ItemsSource="{Binding FilteredContacts}" IsGroupingEnabled="true" GroupDisplayBinding="{Binding Key}" GroupShortNameBinding="{Binding Key}">
      <ListView.ItemTemplate>
        <DataTemplate>
          <TextCell Text="{Binding Name}" TextColor="Black" Detail="{Binding PhoneNumber}" DetailColor="Gray">
          </TextCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

  </Grid>
Run Code Online (Sandbox Code Playgroud)

而现在我正试图从数据列表中"显示某些东西",而不是从动态加载(尚未).

我宣布了这样一个类:

 public class Contact
    {
        public string Name { get; set; }
        public string PhoneNumber { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

现在xaml背后的代码是这样的:

public partial class ContactsPage : MasterDetailPage
    {
        public List<Contact> FilteredContacts = new List<Contact>
            {
                new Contact
                {
                    Name = "Guido", …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml listview xamarin

4
推荐指数
1
解决办法
8059
查看次数

在Xamarin Forms应用程序中获取当前页面名称

我目前正在尝试通过我的Xamarin Form应用程序了解如何获取我目前所使用的(xaml)页面的名称.

我该怎么办呢?我试过各种各样的案例,甚至环顾互联网,但到目前为止我没有任何实际工作:

c# mono xaml xamarin xamarin.forms

2
推荐指数
4
解决办法
1万
查看次数

读取页面导航上传递的字符串数组

当我从WP8.1中的另一个页面传递一个字符串时,我目前不确定如何读取参数.这实际上是我用来在导航到另一个页面时传递参数的代码:

String[] parameters = new String[3];
parameters[0] = ReliabilitySwitch.IsEnabled.ToString();
if (i != 2)
{
    parameters[1] = UnitsList.SelectedItem.ToString();
    parameters[2] = MethodSwitch.IsEnabled.ToString();
}
else
{
    parameters[1] = "2";
}    
Frame.Navigate(typeof(Nav),parameters);
Run Code Online (Sandbox Code Playgroud)

这说,我不知道如何从其他页面读取我传递的参数.我知道如何读取,例如,一个整数值.我试过像这样读这个参数,但我肯定在这个过程中遗漏了一些数据:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    String parameters;
    parameters = e.Parameter.ToString();
}
Run Code Online (Sandbox Code Playgroud)

c# navigation windows-runtime windows-store-apps windows-phone-8.1

1
推荐指数
1
解决办法
838
查看次数