Exemplo n.º 1
0
        public override View GetSampleContent(Context context)
        {
            this.context = context;

            //// Get our button from the layout resource,
            //// and attach an event to it

            var view = LayoutInflater.From(context).Inflate(Resource.Layout.ContactsLayout, null);

            linearLayout = view.FindViewById <RelativeLayout>(Resource.Id.linearLayout);
            listView     = linearLayout.FindViewById <ListView>(Resource.Id.listView);
            var contactList = new ListViewGroupingViewModel().ContactsInfo;

            listView.ChoiceMode    = ChoiceMode.Single;
            listView.Divider       = null;
            listView.DividerHeight = 0;
            listView.ItemClick    += OnItemSelect;
            listView.Adapter       = new ListViewCustomAdapter(context as Activity);

            dataFormView = LayoutInflater.From(context).Inflate(Resource.Layout.DataFormLayout, null);

            var titleRelativeLayout = dataFormView.FindViewById <RelativeLayout>(Resource.Id.titleRelativeLayout);

            var backButton = dataFormView.FindViewById <TextView>(Resource.Id.back);

            backButton.SetBackgroundColor(Color.Transparent);
            backButton.Click += OnBack;

            contactLabel = dataFormView.FindViewById <TextView>(Resource.Id.label);

            editButton = dataFormView.FindViewById <TextView>(Resource.Id.right);
            editButton.SetBackgroundColor(Color.Transparent);
            editButton.Click += OnEditAndDone;

            // SfDataForm settings
            dataForm               = new SfDataForm(context);
            dataForm.ColumnCount   = 2;
            dataForm.LayoutManager = new DataFormLayoutManagerExt(dataForm);
            dataForm.AutoGeneratingDataFormItem += DataForm_AutoGeneratingDataFormItem;

            var dataFormLinearLayout = dataFormView.FindViewById <LinearLayout>(Resource.Id.dataFormLinearLayout);

            dataFormLinearLayout.AddView(dataForm);

            refreshButton      = dataFormView.FindViewById <Button>(Resource.Id.moreFields);
            refreshButton.Text = "More Fields";
            refreshButton.SetBackgroundColor(Color.Transparent);
            refreshButton.SetTextColor(Color.Blue);
            refreshButton.Click += RefreshButton_Click;

            addButton = linearLayout.FindViewById <ImageButton>(Resource.Id.add);
            addButton.SetImageResource(Resource.Drawable.AddContact);
            addButton.SetBackgroundColor(Color.Transparent);
            addButton.Click += OnAdd;

            linearLayout.AddView(dataFormView, WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);

            dataFormView.Visibility = ViewStates.Gone;
            return(linearLayout);
        }
 public ListViewGrouping()
 {
     InitializeComponent();
     groupViewModel       = new ListViewGroupingViewModel();
     listView.ItemsSource = groupViewModel.ContactsInfo;
     InitializeSortDescriptor();
     InitializeGroupDescriptor();
 }
Exemplo n.º 3
0
 public ListViewCustomAdapter(Activity activity)
 {
     context     = activity;
     ContactList = new ListViewGroupingViewModel().ContactsInfo;
 }