iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello Crosslight Support,
I have some questions about the TableView on iOS.
1. I have the built-in TableView and in the ViewController I set InteractionMode the Standard. I want to capture a row click. I thought the override RowSelected would do the trick. But when clicking on a row my breakpoint is never hit. How can I capture a row click in the ViewController? Is there a better my, so I can capture the row click in the ViewModel?
2. This belongs to 1. After clicking on a row, this row is selected. How can I deselect a row after it is clicked?
3. The TableView fills by default the whole screen. If I have less rows with content then the height of the screen, there are empty rows with just a row separator. How can I only show rows with content?
4. I want to set the text of a label programmatically. How can I set the text of a label when the text contains multiple lines? I thought "label.Text = @"Line1\nLine2" would work, but it doesn't.
Thanks for your support.
Thomas
Hello Leo,
Thanks for clarifying.
Hi Thomas,
1. You could make a DelegateCommand in ViewModel and bind it to "TableView" SelectedCommandProperty. ex: this.AddBinding("TableView", BindableProperties.SelectedCommandProperty, "SelectCommand");
2. You could try set InteractionMode to ChoiceInput and ChoiceInputMode to Multiple.
3. I have test MyInventory sample with Item data down to 5. The result show there is no empty rows. Please tell me the step-by-step used to produce the issue and provide me with a sample if possible.
4. It's possible to set a label with multiple lines text. After you set the multi line text, you need to specify the number of lines that will use to render the text. It will look like the following code:label.Text = "Line1\nLine2"label.Lines = 2;
Hope this useful.
Best Regards,Leo
Thanks for your response.
Points 1 and 4 work like you described it. But regarding point 1 I wonder why "RowSelected" or "RowHighlighted" never get called within the ViewController. Are these "Events" suppressed by Crosslight? The same with "OnSelectedItemChanged within the ViewModel. It is not called when changing the selection of the TableView. This seems like a bug to me. By the way, I use the iOS unified assemblies.
Your proposed solution for 2 is not an option for me, because I don't want to have the "checked" icon when a row is selected. Is there another possibility to deselect a selected row? I tried "this.SelectedItem = null;" but it didn't work.
I have attached a screenshot to describe point 3 better. Here the tableview has 4 rows with content, but there are much more row separators shown.
Thanks,
Thanks for your information.I have look into the empty row behaviour that you have mentioned. It is the default behaviour on iOS. But you could change this behaviour by changing Appearance property that is already defined. Please add the following code to your view controller:
public override TableViewAppearance Appearance { get { var appearence = new TableViewAppearance (); appearence.HideSeparatorOnEmptyCell = true; return appearence; } }
As an alternative, you could simple change the appearance on InitializeView.
Regarding deselecting a selected row, it is a non-standard behaviour except for multiple selection. But still, you could easily implement this behaviour on view controller OnViewModelPropertyChanged. That should give a control to what to do in view controller when there is a changes to it's viewmodel property. The following a snipet code about how you deselect a selected row after it is clicked:
BindingProvider :
this.AddBinding("TableView", BindableProperties.SelectedItemProperty, "SelectedItem", BindingMode.TwoWay);
ViewModel :
public override Item SelectedItem { get { return base.SelectedItem; } set { if (base.SelectedItem == value) base.SelectedItem = null; else base.SelectedItem = value; } }
ViewController
protected override void OnViewModelPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "SelectedItem") { if (this.ViewModel.SelectedItem == null) { TableView.DeselectRow (TableView.IndexPathForSelectedRow, true); } } }public override TableViewInteraction InteractionMode { get { return TableViewInteraction.Standard; } }
your proposed solutions work great.
Thanks,Thomas
any news about "RowSelected" or "RowHighlighted" from the developer team?
Sorry for the delay. From the answer I got from our developer team, The event was suppressed by crosslight because all logic operation should be done in ViewModel.
For your information, Programmatically change SelectedItem Property in Standard Interaction Mode issue has been fixed. You should be able to find the hotfix from this link. This hotfix also include fix for SelectedItems issue on this thread.
note : It is recommended to removed the work around that have been suggested previously before you applied this hotfix.
Edit : Hotfix Link has been fixed.
Thank you for the update. Unfortunately, I cannot access the hotfix link. Following "this link" mentoined above, I come to a login page. My regular Intersoft account login does not work here. So, I cannot download the hotfix.
Do you mean "Crosslight4_0_5000_303.zip" with the hotfix? I just downloaded this version from the git repository.
Sorry about the link, I have fixed that. Now the link should have pointed to Crosslight4_0_5000_303 hotfix that you have downloaded.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname