コード例 #1
0
        public override View GetSampleContent(Context context)
        {
            this.context = context;
            density      = context.Resources.DisplayMetrics.Density;
            viewModel    = new ContatsViewModel();

            linearLayout = new LinearLayout(context);
            linearLayout.ViewAttachedToWindow   += SampleLoaded;
            linearLayout.ViewDetachedFromWindow += SampleExited;
            linearLayout.Orientation             = Android.Widget.Orientation.Vertical;

            listView = new ListView(context);
            listView.SetPadding((int)(16 * density), (int)(10 * density), (int)(16 * density), 0);
            listView.DividerHeight = 16;
            listView.Divider.Alpha = 0;
            listView.SetBackgroundColor(Color.ParseColor("#F4F4F4"));
            listView.ItemClick += ListView_ItemClick;
            listView.Adapter    = new CustomPopupAdapter(viewModel, context);

            Label1         = new TextView(context);
            Label1.Gravity = GravityFlags.CenterVertical;
            Label1.Alpha   = 221;
            Label1.SetTextColor(Color.Gray);
            Label1.SetBackgroundColor(Color.ParseColor("#F4F4F4"));
            Label1.TextSize = 20;
            Label1.Text     = "Today";
            Label1.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
            Label1.SetPadding((int)(16 * density), 0, 0, 0);

            linearLayout.AddView(Label1, LinearLayout.LayoutParams.MatchParent, (int)(50 * density));
            linearLayout.AddView(listView);

            return(linearLayout);
        }
コード例 #2
0
        public DataSourceGrouping()
        {
            tableView = new UITableView();
            tableView.AllowsSelection    = false;
            tableView.SeparatorColor     = UIColor.Clear;
            tableView.RowHeight          = 70;
            tableView.EstimatedRowHeight = 70;
            viewModel                                    = new ContatsViewModel();
            sfDataSource                                 = new DataSource();
            sfDataSource.Source                          = viewModel.ContactsList;
            sfDataSource.LiveDataUpdateMode              = LiveDataUpdateMode.AllowDataShaping;
            sfDataSource.DisplayItems.CollectionChanged += DisplayItems_CollectionChanged;
            sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName"));
            sfDataSource.GroupDescriptors.Add(new GroupDescriptor()
            {
                PropertyName = "ContactName",
                KeySelector  = (object obj1) =>
                {
                    var item = (obj1 as Contacts);
                    return(item.ContactName[0].ToString());
                }
            });
            searchbar = new UISearchBar();
            searchbar.OnEditingStarted             += HandleOnEditingStarted;
            searchbar.TextChanged                  += HandleTextChanged;
            searchbar.CancelButtonClicked          += HandleCancelButtonClicked;
            searchbar.EnablesReturnKeyAutomatically = false;
            searchbar.Placeholder                   = "Search Contact";
            tableView.Source = new TableViewSource(sfDataSource);

            this.AddSubview(searchbar);
            this.AddSubview(tableView);
        }
コード例 #3
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            LinearLayout linear = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical
            };

            listView = new ListView(context);
            listView.FastScrollEnabled = true;
            viewModel                       = new ContatsViewModel();
            sfDataSource                    = new DataSource();
            sfDataSource.Source             = viewModel.ContactsList;
            sfDataSource.LiveDataUpdateMode = LiveDataUpdateMode.AllowDataShaping;
            sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName", Syncfusion.DataSource.ListSortDirection.Ascending));
            listView.Adapter = new ContactsAdapter(sfDataSource, context);
            filterText       = new SearchView(context);
            filterText.SetIconifiedByDefault(false);
            filterText.SetPadding(0, 0, 0, (int)(10 * context.Resources.DisplayMetrics.Density));
            filterText.SetQueryHint("Search contact");
            filterText.QueryTextChange += OnFilterTextChanged;
            linear.AddView(new LinearLayout(context)
            {
                Focusable = true, FocusableInTouchMode = true
            }, 0, 0);
            linear.AddView(filterText);
            linear.AddView(listView);
            return(linear);
        }
コード例 #4
0
        public DataSourceSorting()
        {
            tableView                                    = new UITableView();
            tableView.RowHeight                          = 70;
            tableView.SeparatorColor                     = UIColor.Clear;
            tableView.EstimatedRowHeight                 = 70;
            tableView.AllowsSelection                    = false;
            viewModel                                    = new ContatsViewModel();
            sfDataSource                                 = new DataSource();
            sfDataSource.Source                          = viewModel.ContactsList;
            sfDataSource.LiveDataUpdateMode              = LiveDataUpdateMode.AllowDataShaping;
            sfDataSource.DisplayItems.CollectionChanged += DisplayItems_CollectionChanged;
            sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName", Syncfusion.DataSource.ListSortDirection.Ascending));
            tableView.Source = new TableViewSource(sfDataSource);

            searchbar = new UISearchBar();
            searchbar.OnEditingStarted             += HandleOnEditingStarted;
            searchbar.TextChanged                  += HandleTextChanged;
            searchbar.CancelButtonClicked          += HandleCancelButtonClicked;
            searchbar.EnablesReturnKeyAutomatically = false;
            searchbar.Placeholder                   = "Search Contact";

            this.OptionView = CreateOptionView();

            this.AddSubview(searchbar);
            this.AddSubview(tableView);
        }
コード例 #5
0
 public DataSourceSorting()
 {
     InitializeComponent();
     viewModel           = new ContatsViewModel();
     sfDataSource        = new DataSource();
     sfDataSource.Source = viewModel.ContactsList;
     sfDataSource.BeginInit();
     sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName"));
     sfDataSource.EndInit();
     listView.ItemsSource     = sfDataSource.DisplayItems;
     optionList.SelectedIndex = 0;
 }
コード例 #6
0
 public DetailsView()
 {
     tableView                     = new UITableView();
     tableView.RowHeight           = 70;
     tableView.SeparatorColor      = UIColor.Clear;
     tableView.EstimatedRowHeight  = 70;
     tableView.AllowsSelection     = false;
     viewModel                     = new ContatsViewModel();
     sfDataSource                  = new DataSource();
     sfDataSource.Source           = viewModel.ContactsList;
     tableView.Source              = new PopupTableViewSource(sfDataSource);
     tableView.ContentInset        = new UIEdgeInsets(-30, 0, 0, 0);
     tableView.BackgroundColor     = UIColor.FromRGB(244, 244, 244);
     tableView.SectionHeaderHeight = 50;
     tableView.ScrollEnabled       = true;
     DisplayInitialPopup();
     this.AddSubview(tableView);
 }
コード例 #7
0
 public DataSourceGrouping()
 {
     InitializeComponent();
     viewModel           = new ContatsViewModel();
     sfDataSource        = new DataSource();
     sfDataSource.Source = viewModel.ContactsList;
     sfDataSource.BeginInit();
     sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName"));
     sfDataSource.GroupDescriptors.Add(new GroupDescriptor()
     {
         PropertyName = "ContactName",
         KeySelector  = (object obj1) =>
         {
             var item = (obj1 as Contacts);
             return(item.ContactName[0].ToString());
         }
     });
     sfDataSource.EndInit();
     listView.ItemsSource = sfDataSource.DisplayItems;
 }
コード例 #8
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            LinearLayout linear = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical
            };

            listView                        = new ListView(context);
            viewModel                       = new ContatsViewModel();
            sfDataSource                    = new DataSource();
            sfDataSource.Source             = viewModel.ContactsList;
            sfDataSource.LiveDataUpdateMode = LiveDataUpdateMode.AllowDataShaping;
            listView.Adapter                = new ContactsAdapter(sfDataSource, context);
            sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName"));
            sfDataSource.GroupDescriptors.Add(new GroupDescriptor()
            {
                PropertyName = "ContactName",
                KeySelector  = (object obj1) =>
                {
                    var item = (obj1 as Contacts);
                    return(item.ContactName[0].ToString());
                }
            });
            filterText = new SearchView(context);
            filterText.SetIconifiedByDefault(false);
            filterText.SetPadding(0, 0, 0, (int)(10 * context.Resources.DisplayMetrics.Density));
            filterText.SetQueryHint("Search contact");
            filterText.QueryTextChange += OnFilterTextChanged;
            linear.AddView(new LinearLayout(context)
            {
                Focusable = true, FocusableInTouchMode = true
            }, 0, 0);
            linear.AddView(filterText);
            linear.AddView(listView);
            return(linear);
        }
コード例 #9
0
 public CustomPopupAdapter(ContatsViewModel viewmodel, Context contxt) : base()
 {
     this.viewModel = viewmodel;
     this.context   = contxt;
 }
コード例 #10
0
ファイル: DetailsView.cs プロジェクト: chinochuy/Xamarin
 public CustomPopupAdapter(ContatsViewModel viewmodel, Context contxt, SfPopupLayout popup) : base()
 {
     this.viewModel   = viewmodel;
     this.context     = contxt;
     this.popupLayout = popup;
 }