Fixed - 5830 - Updated access modifier for EntryCellTableViewCell (#8286) fixes ...
authorDurgesh Khandal <durgeshlive@gmail.com>
Wed, 30 Oct 2019 12:33:05 +0000 (18:03 +0530)
committerRui Marinho <me@ruimarinho.net>
Wed, 30 Oct 2019 12:33:05 +0000 (12:33 +0000)
Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue5830.cs [new file with mode: 0644]
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
Xamarin.Forms.Platform.iOS/Cells/EntryCellRenderer.cs

index 5e0e59a..962f71b 100644 (file)
@@ -24,6 +24,7 @@ using RectangleF = CoreGraphics.CGRect;
 [assembly: ExportRenderer(typeof(Bugzilla52700.NoSelectionViewCell), typeof(NoSelectionViewCellRenderer))]
 [assembly: ExportRenderer(typeof(Issue1683.EntryKeyboardFlags), typeof(EntryRendererKeyboardFlags))]
 [assembly: ExportRenderer(typeof(Issue1683.EditorKeyboardFlags), typeof(EditorRendererKeyboardFlags))]
+[assembly: ExportRenderer(typeof(Issue5830.ExtendedEntryCell), typeof(ExtendedEntryCellRenderer))]
 namespace Xamarin.Forms.ControlGallery.iOS
 {
 
@@ -691,5 +692,25 @@ namespace Xamarin.Forms.ControlGallery.iOS
                }
        }
 
+       public class ExtendedEntryCellRenderer : EntryCellRenderer
+       {
+               public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
+               {
+                       var entryCell = (EntryCell)item;
+                       var cell = base.GetCell(item, reusableCell, tv);
+                       if (cell != null && entryCell != null)
+                       {
+                               var tvc = cell as EntryCellTableViewCell;
+                               if (tvc != null)
+                               {
+                                       // cell.TextField.thingstocallhere, for example:
+                                       tvc.TextField.Text = entryCell.Text;
+                                       tvc.TextField.TextColor = UIColor.Red;
+                               }
+                       }
+                       return cell;
+               }
+       }
+
 }
 
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue5830.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue5830.cs
new file mode 100644 (file)
index 0000000..831cb6c
--- /dev/null
@@ -0,0 +1,56 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System.Linq;
+using System.Collections.ObjectModel;
+
+#if UITEST
+using Xamarin.Forms.Core.UITests;
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+       [Preserve(AllMembers = true)]
+       [Issue(IssueTracker.Github, 5830, "[Enhancement] EntryCellTableViewCell should be public", PlatformAffected.iOS)]
+       public class Issue5830 : TestContentPage
+       {
+               const string Instructions = "On iOS, if the below Entry Cell displays 'Text from Custom Entry Cell' in 'Red' color, this test has passed.";
+               ListView lstView;
+
+               public class ExtendedEntryCell : EntryCell
+               {
+                       public ExtendedEntryCell()
+                       {
+                               base.Text = "Text from Custom Entry Cell";
+                       }
+               }
+
+               protected override void Init()
+               {
+                       var label = new Label { Text = Instructions };
+                       lstView = new ListView(ListViewCachingStrategy.RecycleElement)
+                       {
+                               ItemTemplate = new DataTemplate(typeof(ExtendedEntryCell)),
+                               ItemsSource = new[] { "item1" }
+                       };
+
+                       Content = new StackLayout
+                       {
+                               Children = {
+                                       label,
+                                       lstView
+                               }
+                       };
+               }
+
+#if (UITEST && __IOS__)
+        [Test]
+               [Category(UITestCategories.ManualReview)]
+        public void Issue5830Test()
+        {
+            RunningApp.Screenshot("EntryTableViewCell Test with custom Text and TextColor");
+        }
+#endif
+       }
+}
\ No newline at end of file
index 25b4377..9a157ae 100644 (file)
@@ -21,6 +21,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)CollectionViewItemsUpdatingScrollMode.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue8186.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue3475.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Issue5830.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue6476.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue7396.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue7825.cs" />
index ed23df7..870a9a5 100644 (file)
@@ -125,7 +125,7 @@ namespace Xamarin.Forms.Platform.iOS
                        cell.TextField.Text = entryCell.Text;
                }
 
-               class EntryCellTableViewCell : CellTableViewCell
+               public class EntryCellTableViewCell : CellTableViewCell
                {
                        public EntryCellTableViewCell(string cellName) : base(UITableViewCellStyle.Value1, cellName)
                        {