Xamarin form - How to customize picket control - xamarin

I am using latest xamarin build 4.5 and trying to apply picker control with following facilities..
Binding option- I could not see ItemsSource property in latest xamarin release. I have used following code to bind picker control in c#
_pcPicker = this.FindByName("pcPicker");
foreach (var item in ParentCategory)
{
_pcPicker.Items.Add(item.Name);
}
I need to bind category id also along with category name...please guide me how to bind and get id of selected category.
I could not follow this link for bindable picker - https://blog.xamarin.com/new-bindable-picker-control-for-xamarin-forms/ ... example given is not complete.
I need add to additional link (Add New category..) at the end of the picker list just as shown in below image.
Please guide me how to customize picker control to achieve these two requirement-
Thanks,
#Paul

This nuget package is great and will allow you to achieve what you want.
https://github.com/rotorgames/Rg.Plugins.Popup
It allows you to create a pop up of any type of page. So for your picker, you could create a view that has a StackPanel, that has a ListView (so you can bind your ItemSource) and then 2 buttons New Category, Edit Category.

Related

Xamarin Forms - Slide out menu to select items

I have a xamarin forms application search screen that allows a user to select an item from a list. Currently I am using a picklist and the user has to scroll and select and click done. This is using the native controls. Howerver I have noticed in iOS in settings menu etc where the have designed it so that when a user want to select from a list a arrow is shown on the right hand side which takes them to another page to select an item (s) from a list. To me this seems like a better UX. Here is an ex:
My question is there something built into this withing xamarin forms? I guess I could create a listview and then on click pass to another page. Any examples are appreciated.
There is no built-in for that, but it's not too hard to achieve this.
To set the disclosure indicator (the arrow), implement a custom renderer derived from ImageCellRenderer and override GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var viewCell = base.GetCell(item, reusableCell, tv);
viewCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
return viewCell;
}
When the user taps that cell you should navigate modally to the view showing the list of languages.
Adding that Cancel-Button is not really hard either, but needs another step. You'll need to wrap the new language selection page in a NavigationPage and push that NavigationPage modally. Furthermore you'll have to add a toolbar item to the wrapped page (see here).
Within the page there is a SearchBar view and a ListView below it. To add the checkmarks, you'll have to implement a custom cell with a custom renderer (derived from ImageCellRenderer like the one shown above), setting the UITableViewCell.Accessory to Checkmark if the custom cell is selected
if(item is SelectableCell selectableCell)
{
var selected = selectableCell.IsSelected;
viewCell.Accessory = selected ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.Checkmark;
}
Please note: Selectable cell is no Xamarin.Forms stock cell, but one that you have to implement by yourself, including the bindable property IsSelected.
This should be basically the steps you need to achieve what you want. I've assumed basic Xamarin.Forms knowledge that is needed to fill the gaps.

Adding “AllowUpload” to the landed code tab in the Bill and adjustment screen

I'm trying to add the ability to upload order lines into landed cost on the bills and adjustment screen via excel or csv. I customized the screen and set AllowUpload to True. enter image description here But i don't know how to use the [PXImport]. Can you guy show me step by step.Ex: what is the BQL and where
to put it. Be specific. Thanks
First determine the name of the DataView bound to the grid. To do that you can hold Ctl-Alt and click on the header of the grid and select Customize. It will open the customization project editor in the Screen section. Click on the top most element of the tree view in the middle to select the grid. Lookup the DataMember property on the property pane on the right side, this is the name of the DataView. While in the project editor, expand the Mode section of the property pane and set AllowUpload property to True.
Now that you know the name of the DataView you need to decorate it with the PXImport attribute. Create a Graph Extension in the code section of the project editor for this screen if you haven't already. In the Graph Extension, for a new DataView that you have created you add [PXImport(typeof(PrimaryDac)] right before the DataView declaration like this:
[PXImport(typeof(APInvoice))]
public PXSelect<MyDAC> MyDataView;
For an existing DataView from the base class you can override it in the same way:
[PXImport(typeof(APInvoice))]
public PXSelect<DAC> BaseDataView;
The Primary DAC can be found in the class declaration of the base graph:
public class APInvoiceEntry : APDataEntryGraph<APInvoiceEntry, APInvoice>, PXImportAttribute.IPXPrepareItems
Reference: Enabling Upload from Excel for the Grid

Hide Group header in Grouped ListView

I'm displaying a GroupedList view, and have both enabled the group header and jumplist. I've tried to hide the Group header, but so far with no luck. This property I want to hide is GroupDisplayBinding. If I don't set it, a default of ToString for my Item is displayed. I just want it gone, as a regular list only with the jump option enabled.
A little update: I searched some samples and what I want is a TableView with and indexed list as displayed here: https://developer.xamarin.com/guides/ios/user_interface/tables/part_2_-_populating_a_table_with_data/#Adding_an_Index
Best regards
Xamarin.Forms listview allows you to specify your own layout for the listview group via GroupHeaderTemplate property. You can use this layout to keep the header content empty.
Have a look at Customizing Listview Grouping
If you want to define the group header layout in code you will have to create a new subclass of ViewCell and build the layout. See an example at Enhancing Xamarin.Forms ListView with Grouping Headers

How to bind data to Picker inside ListView in Xamarin Forms

I am using Xamarin forms and my app has a list of items as a list view and each list item need to have a Picker. How do I bind data to the Picker controllers? Is there a way to access the child items inside a list view?
Just define your data template for the list view as normal (there are a lot of examples for this on the web), then inside the item template bind the desired item to a picker control (also a lot of examples out there).
There shouldn't be anything special about it.

how we use pageindiactor in pivot

i want to use page indicator control in pivot ,to show the user which page they attract.but i also want to add some functionality in page indicator to select the page with the help of page indicator like android .but i don't know how it is possible.if u know then send me a link or example
You could create the ui yourself and update the current page indicator by using the selectedIndex property. There are controls created by other developers, like here, which you could use. But for complete control over the functionality, I'd suggest you create your own or use the source code provided by other developers (see above link) to get ideas.
To make the implementation clearer:
You can add the same UIElement containing a list of dots equal to the number of pivots, and using the SelectedIndex property you can fill the corresponding dot. Add gesture events to this element and handle it to change the SelectedIndex appropriately.

Resources