Xamarin.forms: [Enhancement] EntryCellTableViewCell should be public

Created on 6 Apr 2019  Â·  9Comments  Â·  Source: xamarin/Xamarin.Forms

Summary

I'd like to be able to access the TextView from within the EntryCellRenderer but it is currently inaccessible due to its protection level.

Currently access is only available via a hack UITextField textField = (UITextField)cell.ContentView.Subviews [0]; as demonstrated here.

API Changes

Change class EntryCellTableViewCell : CellTableViewCell to public class EntryCellTableViewCell : CellTableViewCell

Code Reference

Intended Use Case

Allow for further customization from platform specific renderers.

public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
 {
            EntryTableViewCell cell = item as EntryTableViewCell;
            // cell.TextField.thingstocallhere
            return cell;
 }
help wanted inactive enhancement âž• up-for-grabs

All 9 comments

@acupajoe We're happy to consider exposing the EntryCellTableViewCell! May I ask what you'd like to do with it? Perhaps we can expose something in the Core API that would be easier to access and provide greater value. Thanks!

@samhouts thanks for responding! Entry cells allow you to set the text color of descriptive text but not the placeholder color or value text color. I needed a custom renderer for it and had to use the _hacky_ version (seen in OP) to do so. Ideally this would be exposed in the Forms API, but this seemed like an easier fix!

@acupajoe That makes sense! Would you have found using a ViewCell with an Entry as a suitable solution, as well? Thanks!

@samhouts It would, you'd have to combine it into a StackLayout with a Label and Entry for the same functionality, but yes that would work!

Hi Team (@samhouts / @jfversluis ),

I'd like to pick this up. Do we see any issues with making EntryCellTableViewCell as public (in-case discussed internally) ?

Thanks!

Not sure what @samhouts opinion on this might be, but as the CollectionView is becoming stable and should be preferred over ListView and TableView I'm not sure if we should spend much time in this area and make changes to stimulate the usage of these controls.

@samhouts
Another reason to possibly make this class public - I need to set the AccessibilityIdentifier on the text field, so my UI Test can tap the entry. I could use a ViewCell but was trying to stick with EntryCell for the performance benefit.
(edit: I found that I can just set the AccessibilityIdentifier on the Cell itself, and UITest taps the entry part correctly)

@samhouts / @jfversluis : What do you suggest for the above use-case? I guess it makes sense to make it public so the existing users/apps (which are not using CollectionView and I guess there are many of them) can still get benefit from it. I'd like to pick this up unless if there's any better way?
Thanks!

@techduggu Go ahead! I see no issue with doing this.

Was this page helpful?
0 / 5 - 0 ratings