summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-07-10 06:42:16 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-10-23 04:34:38 (GMT)
commitf2241f6713c416f509d1e48e8ecdf77517675ec7 (patch)
tree431bf2692e75734df434efbc98628deeffe41411
parenta605093b48e4199f2f6aea6d8884c2315256d049 (diff)
downloadxamarin-forms-f2241f6713c416f509d1e48e8ecdf77517675ec7.zip
xamarin-forms-f2241f6713c416f509d1e48e8ecdf77517675ec7.tar.gz
xamarin-forms-f2241f6713c416f509d1e48e8ecdf77517675ec7.tar.bz2
Revert "Move registration of property handles to static constructors"
This reverts commit 509e6f117c9966e5503deb8ff1c5135b41eb2a3e. Change-Id: Icb16fdc0b1006405a92e4e5ef77f20749c2ce3e5
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs11
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs28
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs19
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs18
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/MasterDetailPageRenderer.cs15
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs7
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs25
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/StepperRenderer.cs11
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/TableViewRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs10
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs74
19 files changed, 151 insertions, 147 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs
index cb72bcd..fdad3c7 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs
@@ -7,10 +7,10 @@ namespace Xamarin.Forms.Platform.Tizen
{
static readonly EColor s_defaultColor = new EColor(129, 198, 255);
- static ActivityIndicatorRenderer()
+ public ActivityIndicatorRenderer()
{
- RegisterPropertyHandler(ActivityIndicator.ColorProperty, (r, i) => (r as ActivityIndicatorRenderer).UpdateColor(i));
- RegisterPropertyHandler(ActivityIndicator.IsRunningProperty, (r) => (r as ActivityIndicatorRenderer).UpdateIsRunning());
+ RegisterPropertyHandler(ActivityIndicator.ColorProperty, UpdateColor);
+ RegisterPropertyHandler(ActivityIndicator.IsRunningProperty, UpdateIsRunning);
}
protected override void OnElementChanged(ElementChangedEventArgs<ActivityIndicator> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
index 4de9604..0125cfe 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
@@ -6,14 +6,14 @@ namespace Xamarin.Forms.Platform.Tizen
{
public class ButtonRenderer : ViewRenderer<Button, Native.Button>
{
- static ButtonRenderer()
+ public ButtonRenderer()
{
- RegisterPropertyHandler(Button.TextProperty, (r) => (r as ButtonRenderer).UpdateText());
- RegisterPropertyHandler(Button.FontFamilyProperty, (r) => (r as ButtonRenderer).UpdateFontFamily());
- RegisterPropertyHandler(Button.FontSizeProperty, (r) => (r as ButtonRenderer).UpdateFontSize());
- RegisterPropertyHandler(Button.FontAttributesProperty, (r) => (r as ButtonRenderer).UpdateFontAttributes());
- RegisterPropertyHandler(Button.TextColorProperty, (r) => (r as ButtonRenderer).UpdateTextColor());
- RegisterPropertyHandler(Button.ImageProperty, (r) => (r as ButtonRenderer).UpdateBitmap());
+ RegisterPropertyHandler(Button.TextProperty, UpdateText);
+ RegisterPropertyHandler(Button.FontFamilyProperty, UpdateFontFamily);
+ RegisterPropertyHandler(Button.FontSizeProperty, UpdateFontSize);
+ RegisterPropertyHandler(Button.FontAttributesProperty, UpdateFontAttributes);
+ RegisterPropertyHandler(Button.TextColorProperty, UpdateTextColor);
+ RegisterPropertyHandler(Button.ImageProperty, UpdateBitmap);
RegisterPropertyHandler(Button.BorderColorProperty, UpdateBorder);
RegisterPropertyHandler(Button.BorderRadiusProperty, UpdateBorder);
RegisterPropertyHandler(Button.BorderWidthProperty, UpdateBorder);
@@ -102,7 +102,7 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
- static void UpdateBorder(VisualElementRenderer<Button> r)
+ void UpdateBorder()
{
/* The simpler way is to create some specialized theme for button in
* tizen-theme
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs
index 1380b77..714f41b 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs
@@ -13,10 +13,13 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
Native.ContentPage _page;
- static ContentPageRenderer()
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ContentPageRenderer()
{
- RegisterPropertyHandler(Page.BackgroundImageProperty, (r, i) => (r as ContentPageRenderer).UpdateBackgroundImage(i));
- RegisterPropertyHandler(Page.TitleProperty, (r) => (r as ContentPageRenderer).UpdateTitle());
+ RegisterPropertyHandler(Page.BackgroundImageProperty, UpdateBackgroundImage);
+ RegisterPropertyHandler(Page.TitleProperty, UpdateTitle);
}
protected override void OnElementChanged(ElementChangedEventArgs<ContentPage> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
index c4b88e8..39a2529 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
@@ -7,11 +7,11 @@ namespace Xamarin.Forms.Platform.Tizen
//TODO need to add internationalization support
const string DialogTitle = "Choose Date";
- static DatePickerRenderer()
+ public DatePickerRenderer()
{
RegisterPropertyHandler(DatePicker.DateProperty, UpdateDate);
RegisterPropertyHandler(DatePicker.FormatProperty, UpdateDate);
- RegisterPropertyHandler(DatePicker.TextColorProperty, (r) => (r as DatePickerRenderer).UpdateTextColor());
+ RegisterPropertyHandler(DatePicker.TextColorProperty, UpdateTextColor);
}
protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
@@ -75,11 +75,6 @@ namespace Xamarin.Forms.Platform.Tizen
dialog.Dismissed -= OnDialogDismissed;
}
- static void UpdateDate(VisualElementRenderer<DatePicker> renderer)
- {
- (renderer as DatePickerRenderer).UpdateDate();
- }
-
void UpdateDate()
{
Control.Text = Element.Date.ToString(Element.Format);
@@ -90,4 +85,4 @@ namespace Xamarin.Forms.Platform.Tizen
Control.TextColor = Element.TextColor.ToNative();
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
index f8a1045..39e018c 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
@@ -6,14 +6,14 @@ namespace Xamarin.Forms.Platform.Tizen
{
public class EditorRenderer : ViewRenderer<Editor, Native.Entry>
{
- static EditorRenderer()
+ public EditorRenderer()
{
- RegisterPropertyHandler(Editor.TextProperty, (r) => (r as EditorRenderer).UpdateText());
- RegisterPropertyHandler(Editor.TextColorProperty, (r) => (r as EditorRenderer).UpdateTextColor());
- RegisterPropertyHandler(Editor.FontSizeProperty, (r) => (r as EditorRenderer).UpdateFontSize());
- RegisterPropertyHandler(Editor.FontFamilyProperty, (r) => (r as EditorRenderer).UpdateFontFamily());
- RegisterPropertyHandler(Editor.FontAttributesProperty, (r) => (r as EditorRenderer).UpdateFontAttributes());
- RegisterPropertyHandler(Editor.KeyboardProperty, (r, i) => (r as EditorRenderer).UpdateKeyboard(i));
+ RegisterPropertyHandler(Editor.TextProperty, UpdateText);
+ RegisterPropertyHandler(Editor.TextColorProperty, UpdateTextColor);
+ RegisterPropertyHandler(Editor.FontSizeProperty, UpdateFontSize);
+ RegisterPropertyHandler(Editor.FontFamilyProperty, UpdateFontFamily);
+ RegisterPropertyHandler(Editor.FontAttributesProperty, UpdateFontAttributes);
+ RegisterPropertyHandler(Editor.KeyboardProperty, UpdateKeyboard);
}
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
@@ -93,4 +93,4 @@ namespace Xamarin.Forms.Platform.Tizen
Control.Keyboard = Element.Keyboard.ToNative();
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
index b240b8d..842aae8 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
@@ -6,21 +6,21 @@ namespace Xamarin.Forms.Platform.Tizen
{
public class EntryRenderer : ViewRenderer<Entry, Native.Entry>, IDisposable
{
- static EntryRenderer()
- {
- RegisterPropertyHandler(Entry.IsPasswordProperty, (r) => (r as EntryRenderer).UpdateIsPassword());
- RegisterPropertyHandler(Entry.TextProperty, (r) => (r as EntryRenderer).UpdateText());
- RegisterPropertyHandler(Entry.TextColorProperty, (r) => (r as EntryRenderer).UpdateTextColor());
- RegisterPropertyHandler(Entry.FontSizeProperty, (r) => (r as EntryRenderer).UpdateFontSize());
- RegisterPropertyHandler(Entry.FontFamilyProperty, (r) => (r as EntryRenderer).UpdateFontFamily());
- RegisterPropertyHandler(Entry.FontAttributesProperty, (r) => (r as EntryRenderer).UpdateFontAttributes());
- RegisterPropertyHandler(Entry.HorizontalTextAlignmentProperty, (r) => (r as EntryRenderer).UpdateHorizontalTextAlignment());
- RegisterPropertyHandler(Entry.KeyboardProperty, (r, i) => (r as EntryRenderer).UpdateKeyboard(i));
- RegisterPropertyHandler(Entry.PlaceholderProperty, (r) => (r as EntryRenderer).UpdatePlaceholder());
- RegisterPropertyHandler(Entry.PlaceholderColorProperty, (r) => (r as EntryRenderer).UpdatePlaceholderColor());
+ public EntryRenderer()
+ {
+ RegisterPropertyHandler(Entry.IsPasswordProperty, UpdateIsPassword);
+ RegisterPropertyHandler(Entry.TextProperty, UpdateText);
+ RegisterPropertyHandler(Entry.TextColorProperty, UpdateTextColor);
+ RegisterPropertyHandler(Entry.FontSizeProperty, UpdateFontSize);
+ RegisterPropertyHandler(Entry.FontFamilyProperty, UpdateFontFamily);
+ RegisterPropertyHandler(Entry.FontAttributesProperty, UpdateFontAttributes);
+ RegisterPropertyHandler(Entry.HorizontalTextAlignmentProperty, UpdateHorizontalTextAlignment);
+ RegisterPropertyHandler(Entry.KeyboardProperty, UpdateKeyboard);
+ RegisterPropertyHandler(Entry.PlaceholderProperty, UpdatePlaceholder);
+ RegisterPropertyHandler(Entry.PlaceholderColorProperty, UpdatePlaceholderColor);
if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable)
{
- RegisterPropertyHandler("FontWeight", (r) => (r as EntryRenderer).UpdateFontWeight());
+ RegisterPropertyHandler("FontWeight", UpdateFontWeight);
}
}
@@ -131,4 +131,4 @@ namespace Xamarin.Forms.Platform.Tizen
Control.FontWeight = Specific.GetFontWeight(Element);
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
index 414553f..47bc703 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
@@ -15,10 +15,10 @@ namespace Xamarin.Forms.Platform.Tizen
Polygon _shadow = null;
Polygon _frame = null;
- static FrameRenderer()
+ public FrameRenderer()
{
- RegisterPropertyHandler(Frame.OutlineColorProperty, (r) => (r as FrameRenderer).UpdateColor());
- RegisterPropertyHandler(Frame.HasShadowProperty, (r) => (r as FrameRenderer).UpdateShadowVisibility());
+ RegisterPropertyHandler(Frame.OutlineColorProperty, UpdateColor);
+ RegisterPropertyHandler(Frame.HasShadowProperty, UpdateShadowVisibility);
}
protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
index 16c36ec..42e8a15 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
@@ -7,19 +7,20 @@ namespace Xamarin.Forms.Platform.Tizen
public class LabelRenderer : ViewRenderer<Label, Native.Label>
{
- static LabelRenderer()
+
+ public LabelRenderer()
{
- RegisterPropertyHandler(Label.TextProperty, (r) => (r as LabelRenderer).UpdateText());
- RegisterPropertyHandler(Label.TextColorProperty, (r) => (r as LabelRenderer).UpdateTextColor());
+ RegisterPropertyHandler(Label.TextProperty, UpdateText);
+ RegisterPropertyHandler(Label.TextColorProperty, UpdateTextColor);
// FontProperty change is called also for FontSizeProperty, FontFamilyProperty and FontAttributesProperty change
- RegisterPropertyHandler(Label.FontProperty, (r) => (r as LabelRenderer).UpdateFontProperties());
- RegisterPropertyHandler(Label.LineBreakModeProperty, (r) => (r as LabelRenderer).UpdateLineBreakMode());
- RegisterPropertyHandler(Label.HorizontalTextAlignmentProperty, (r) => (r as LabelRenderer).UpdateHorizontalTextAlignment());
- RegisterPropertyHandler(Label.VerticalTextAlignmentProperty, (r) => (r as LabelRenderer).UpdateVerticalTextAlignment());
- RegisterPropertyHandler(Label.FormattedTextProperty, (r) => (r as LabelRenderer).UpdateFormattedText());
+ RegisterPropertyHandler(Label.FontProperty, UpdateFontProperties);
+ RegisterPropertyHandler(Label.LineBreakModeProperty, UpdateLineBreakMode);
+ RegisterPropertyHandler(Label.HorizontalTextAlignmentProperty, UpdateHorizontalTextAlignment);
+ RegisterPropertyHandler(Label.VerticalTextAlignmentProperty, UpdateVerticalTextAlignment);
+ RegisterPropertyHandler(Label.FormattedTextProperty, UpdateFormattedText);
if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable)
{
- RegisterPropertyHandler("FontWeight", (r) => (r as LabelRenderer).UpdateFontWeight());
+ RegisterPropertyHandler("FontWeight", UpdateFontWeight);
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs
index de86a25..1141afb 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs
@@ -35,15 +35,15 @@ namespace Xamarin.Forms.Platform.Tizen
/// Note that at this stage of construction renderer dose not have required native element. This should
/// only be used with xamarin engine.
/// </summary>
- static ListViewRenderer()
+ public ListViewRenderer()
{
- RegisterPropertyHandler(ListView.IsGroupingEnabledProperty, (r, i) => (r as ListViewRenderer).UpdateIsGroupingEnabled(i));
- RegisterPropertyHandler(ListView.HasUnevenRowsProperty, (r) => (r as ListViewRenderer).UpdateHasUnevenRows());
- RegisterPropertyHandler(ListView.RowHeightProperty, (r, i) => (r as ListViewRenderer).UpdateRowHeight(i));
- RegisterPropertyHandler(ListView.SelectedItemProperty, (r) => (r as ListViewRenderer).UpdateSelectedItem());
- RegisterPropertyHandler(ListView.ItemsSourceProperty, (r) => (r as ListViewRenderer).UpdateSource());
- RegisterPropertyHandler("HeaderElement", (r) => (r as ListViewRenderer).UpdateHeader());
- RegisterPropertyHandler("FooterElement", (r) => (r as ListViewRenderer).UpdateFooter());
+ RegisterPropertyHandler(ListView.IsGroupingEnabledProperty, UpdateIsGroupingEnabled);
+ RegisterPropertyHandler(ListView.HasUnevenRowsProperty, UpdateHasUnevenRows);
+ RegisterPropertyHandler(ListView.RowHeightProperty, UpdateRowHeight);
+ RegisterPropertyHandler(ListView.SelectedItemProperty, UpdateSelectedItem);
+ RegisterPropertyHandler(ListView.ItemsSourceProperty, UpdateSource);
+ RegisterPropertyHandler("HeaderElement", UpdateHeader);
+ RegisterPropertyHandler("FooterElement", UpdateFooter);
}
/// <summary>
@@ -382,4 +382,4 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/MasterDetailPageRenderer.cs
index 2acfb3a..0608039 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/MasterDetailPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/MasterDetailPageRenderer.cs
@@ -6,16 +6,19 @@ namespace Xamarin.Forms.Platform.Tizen
{
Native.MasterDetailPage _mdpage;
- static MasterDetailPageRenderer()
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public MasterDetailPageRenderer()
{
- RegisterPropertyHandler("Master", (r) => (r as MasterDetailPageRenderer).UpdateMasterPage());
- RegisterPropertyHandler("Detail", (r) => (r as MasterDetailPageRenderer).UpdateDetailPage());
+ RegisterPropertyHandler("Master", UpdateMasterPage);
+ RegisterPropertyHandler("Detail", UpdateDetailPage);
RegisterPropertyHandler(MasterDetailPage.IsPresentedProperty,
- (r) => (r as MasterDetailPageRenderer).UpdateIsPresented());
+ UpdateIsPresented);
RegisterPropertyHandler(MasterDetailPage.MasterBehaviorProperty,
- (r) => (r as MasterDetailPageRenderer).UpdateMasterBehavior());
+ UpdateMasterBehavior);
RegisterPropertyHandler(MasterDetailPage.IsGestureEnabledProperty,
- (r) => (r as MasterDetailPageRenderer).UpdateIsGestureEnabled());
+ UpdateIsGestureEnabled);
}
protected override void OnElementChanged(ElementChangedEventArgs<MasterDetailPage> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs
index 9f94f20..0168d2d 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs
@@ -11,9 +11,12 @@ namespace Xamarin.Forms.Platform.Tizen
{
EvasObject _content;
- static ScrollViewRenderer()
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.ScrollViewRenderer"/> class.
+ /// </summary>
+ public ScrollViewRenderer()
{
- RegisterPropertyHandler("Content", (r) => (r as ScrollViewRenderer).FillContent());
+ RegisterPropertyHandler("Content", FillContent);
}
/// <summary>
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs
index 339bd00..3e3344f 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs
@@ -13,18 +13,21 @@ namespace Xamarin.Forms.Platform.Tizen
//TODO: read default platform color
static readonly EColor s_defaultPlaceholderColor = EColor.Gray;
static readonly EColor s_defaultTextColor = EColor.Black;
-
- static SearchBarRenderer()
+ /// <summary>
+ /// Creates a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.SearchBarRenderer"/> class.
+ /// Registers handlers for various properties of the SearchBar widget.
+ /// </summary>
+ public SearchBarRenderer()
{
- RegisterPropertyHandler(SearchBar.CancelButtonColorProperty, (r) => (r as SearchBarRenderer).CancelButtonColorPropertyHandler());
- RegisterPropertyHandler(SearchBar.FontAttributesProperty, (r) => (r as SearchBarRenderer).FontAttributesPropertyHandler());
- RegisterPropertyHandler(SearchBar.FontFamilyProperty, (r) => (r as SearchBarRenderer).FontFamilyPropertyHandler());
- RegisterPropertyHandler(SearchBar.FontSizeProperty, (r) => (r as SearchBarRenderer).FontSizePropertyHandler());
- RegisterPropertyHandler(SearchBar.HorizontalTextAlignmentProperty, (r) => (r as SearchBarRenderer).HorizontalTextAlignmentPropertyHandler());
- RegisterPropertyHandler(SearchBar.PlaceholderProperty, (r) => (r as SearchBarRenderer).PlaceholderPropertyHandler());
- RegisterPropertyHandler(SearchBar.PlaceholderColorProperty, (r) => (r as SearchBarRenderer).PlaceholderColorPropertyHandler());
- RegisterPropertyHandler(SearchBar.TextProperty, (r) => (r as SearchBarRenderer).TextPropertyHandler());
- RegisterPropertyHandler(SearchBar.TextColorProperty, (r) => (r as SearchBarRenderer).TextColorPropertyHandler());
+ RegisterPropertyHandler(SearchBar.CancelButtonColorProperty, CancelButtonColorPropertyHandler);
+ RegisterPropertyHandler(SearchBar.FontAttributesProperty, FontAttributesPropertyHandler);
+ RegisterPropertyHandler(SearchBar.FontFamilyProperty, FontFamilyPropertyHandler);
+ RegisterPropertyHandler(SearchBar.FontSizeProperty, FontSizePropertyHandler);
+ RegisterPropertyHandler(SearchBar.HorizontalTextAlignmentProperty, HorizontalTextAlignmentPropertyHandler);
+ RegisterPropertyHandler(SearchBar.PlaceholderProperty, PlaceholderPropertyHandler);
+ RegisterPropertyHandler(SearchBar.PlaceholderColorProperty, PlaceholderColorPropertyHandler);
+ RegisterPropertyHandler(SearchBar.TextProperty, TextPropertyHandler);
+ RegisterPropertyHandler(SearchBar.TextColorProperty, TextColorPropertyHandler);
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs
index cf20ff9..db72583 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs
@@ -6,11 +6,12 @@ namespace Xamarin.Forms.Platform.Tizen
{
public class SliderRenderer : ViewRenderer<Slider, ESlider>
{
- static SliderRenderer()
+
+ public SliderRenderer()
{
- RegisterPropertyHandler(Slider.ValueProperty, (r) => (r as SliderRenderer).UpdateValue());
- RegisterPropertyHandler(Slider.MinimumProperty, (r) => (r as SliderRenderer).UpdateMinimum());
- RegisterPropertyHandler(Slider.MaximumProperty, (r) => (r as SliderRenderer).UpdateMaximum());
+ RegisterPropertyHandler(Slider.ValueProperty, UpdateValue);
+ RegisterPropertyHandler(Slider.MinimumProperty, UpdateMinimum);
+ RegisterPropertyHandler(Slider.MaximumProperty, UpdateMaximum);
}
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/StepperRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/StepperRenderer.cs
index 40133d7..a1cf311 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/StepperRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/StepperRenderer.cs
@@ -5,12 +5,13 @@ namespace Xamarin.Forms.Platform.Tizen
{
public class StepperRenderer : ViewRenderer<Stepper, Spinner>
{
- static StepperRenderer()
+
+ public StepperRenderer()
{
- RegisterPropertyHandler(Stepper.ValueProperty, (r) => (r as StepperRenderer).UpdateValue());
- RegisterPropertyHandler(Stepper.MinimumProperty, (r) => (r as StepperRenderer).UpdateMinimum());
- RegisterPropertyHandler(Stepper.MaximumProperty, (r) => (r as StepperRenderer).UpdateMaximum());
- RegisterPropertyHandler(Stepper.IncrementProperty, (r) => (r as StepperRenderer).UpdateStep());
+ RegisterPropertyHandler(Stepper.ValueProperty, UpdateValue);
+ RegisterPropertyHandler(Stepper.MinimumProperty, UpdateMinimum);
+ RegisterPropertyHandler(Stepper.MaximumProperty, UpdateMaximum);
+ RegisterPropertyHandler(Stepper.IncrementProperty, UpdateStep);
}
protected override void OnElementChanged(ElementChangedEventArgs<Stepper> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
index 5a74872..5c6814a 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
@@ -8,9 +8,9 @@ namespace Xamarin.Forms.Platform.Tizen
{
public class SwitchRenderer : ViewRenderer<Switch, Check>
{
- static SwitchRenderer()
+ public SwitchRenderer()
{
- RegisterPropertyHandler(Switch.IsToggledProperty, (r) => (r as SwitchRenderer).HandleToggled());
+ RegisterPropertyHandler(Switch.IsToggledProperty, HandleToggled);
}
protected override void OnElementChanged(ElementChangedEventArgs<Switch> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs
index 9a9aa0f..3af1b34 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs
@@ -18,11 +18,11 @@ namespace Xamarin.Forms.Platform.Tizen
Toolbar _toolbar;
Dictionary<EToolbarItem, Page> _itemToItemPage = new Dictionary<EToolbarItem, Page>();
- static TabbedPageRenderer()
+ public TabbedPageRenderer()
{
- RegisterPropertyHandler(TabbedPage.TitleProperty, (r) => (r as TabbedPageRenderer).UpdateTitle());
- RegisterPropertyHandler("CurrentPage", (r) => (r as TabbedPageRenderer).CurrentPageChanged());
- RegisterPropertyHandler(TabbedPage.BarBackgroundColorProperty, (r) => (r as TabbedPageRenderer).UpdateBarBackgroundColor());
+ RegisterPropertyHandler(TabbedPage.TitleProperty, UpdateTitle);
+ RegisterPropertyHandler("CurrentPage", CurrentPageChanged);
+ RegisterPropertyHandler(TabbedPage.BarBackgroundColorProperty, UpdateBarBackgroundColor);
}
protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TableViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TableViewRenderer.cs
index 76539a6..58b17a4 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/TableViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/TableViewRenderer.cs
@@ -7,10 +7,10 @@ namespace Xamarin.Forms.Platform.Tizen
{
internal static BindableProperty PresentationProperty = BindableProperty.Create("Presentation", typeof(View), typeof(TableSectionBase), null, BindingMode.OneWay, null, null, null, null, null as BindableProperty.CreateDefaultValueDelegate);
- static TableViewRenderer()
+ public TableViewRenderer()
{
- RegisterPropertyHandler(TableView.HasUnevenRowsProperty, (r) => (r as TableViewRenderer).UpdateHasUnevenRows());
- RegisterPropertyHandler(TableView.RowHeightProperty, (r) => (r as TableViewRenderer).UpdateRowHeight());
+ RegisterPropertyHandler(TableView.HasUnevenRowsProperty, UpdateHasUnevenRows);
+ RegisterPropertyHandler(TableView.RowHeightProperty, UpdateRowHeight);
}
protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
index 0e46ae9..211ccf3 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
@@ -12,11 +12,11 @@ namespace Xamarin.Forms.Platform.Tizen
TimeSpan _time = DateTime.Now.TimeOfDay;
- static TimePickerRenderer()
+ public TimePickerRenderer()
{
- RegisterPropertyHandler(TimePicker.FormatProperty, (r) => (r as TimePickerRenderer).UpdateFormat());
- RegisterPropertyHandler(TimePicker.TimeProperty, (r) => (r as TimePickerRenderer).UpdateTime());
- RegisterPropertyHandler(TimePicker.TextColorProperty, (r) => (r as TimePickerRenderer).UpdateTextColor());
+ RegisterPropertyHandler(TimePicker.FormatProperty, UpdateFormat);
+ RegisterPropertyHandler(TimePicker.TimeProperty, UpdateTime);
+ RegisterPropertyHandler(TimePicker.TextColorProperty, UpdateTextColor);
}
protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
@@ -102,4 +102,4 @@ namespace Xamarin.Forms.Platform.Tizen
Control.Text = new DateTime(_time.Ticks).ToString(Element.Format ?? s_defaultFormat);
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
index 5b80bd0..a6c1c3a 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
@@ -33,38 +33,37 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
EvasObject _view;
- static Dictionary<string, Action<VisualElementRenderer<TElement>, bool>> s_propertyHandlersWithInit = new Dictionary<string, Action<VisualElementRenderer<TElement>, bool>>();
+ Dictionary<string, Action<bool>> _propertyHandlersWithInit = new Dictionary<string, Action<bool>>();
- static Dictionary<string, Action<VisualElementRenderer<TElement>>> s_propertyHandlers = new Dictionary<string, Action<VisualElementRenderer<TElement>>>();
+ Dictionary<string, Action> _propertyHandlers = new Dictionary<string, Action>();
HashSet<string> _batchedProperties = new HashSet<string>();
bool _movedCallbackEnabled = false;
-
/// <summary>
/// Default constructor.
/// </summary>
- static VisualElementRenderer()
+ protected VisualElementRenderer()
{
- RegisterPropertyHandler(VisualElement.IsVisibleProperty, (r) => r.UpdateIsVisible());
- RegisterPropertyHandler(VisualElement.OpacityProperty, (r, i) => r.UpdateOpacity(i));
- RegisterPropertyHandler(VisualElement.IsEnabledProperty, (r, i) => r.UpdateIsEnabled(i));
- RegisterPropertyHandler(VisualElement.InputTransparentProperty, (r, i) => r.UpdateInputTransparent(i));
- RegisterPropertyHandler(VisualElement.BackgroundColorProperty, (r, i) => r.UpdateBackgroundColor(i));
+ RegisterPropertyHandler(VisualElement.IsVisibleProperty, UpdateIsVisible);
+ RegisterPropertyHandler(VisualElement.OpacityProperty, UpdateOpacity);
+ RegisterPropertyHandler(VisualElement.IsEnabledProperty, UpdateIsEnabled);
+ RegisterPropertyHandler(VisualElement.InputTransparentProperty, UpdateInputTransparent);
+ RegisterPropertyHandler(VisualElement.BackgroundColorProperty, UpdateBackgroundColor);
// Use TizenSpecific APIs only if available
if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable)
{
- RegisterPropertyHandler("ThemeStyle", (r) => r.UpdateThemeStyle());
- RegisterPropertyHandler("IsFocusAllowed", (r, i) => r.UpdateFocusAllowed(i));
- RegisterPropertyHandler("NextFocusDirection", (r, i) => r.UpdateFocusDirection(i));
- RegisterPropertyHandler("NextFocusUpView", (r, i) => r.UpdateFocusUpView(i));
- RegisterPropertyHandler("NextFocusDownView", (r, i) => r.UpdateFocusDownView(i));
- RegisterPropertyHandler("NextFocusLeftView", (r, i) => r.UpdateFocusLeftView(i));
- RegisterPropertyHandler("NextFocusRightView", (r, i) => r.UpdateFocusRightView(i));
- RegisterPropertyHandler("NextFocusBackView", (r, i) => r.UpdateFocusBackView(i));
- RegisterPropertyHandler("NextFocusForwardView", (r, i) => r.UpdateFocusForwardView(i));
- RegisterPropertyHandler("ToolTip", (r, i) => r.UpdateToolTip(i));
+ RegisterPropertyHandler("ThemeStyle", UpdateThemeStyle);
+ RegisterPropertyHandler("IsFocusAllowed", UpdateFocusAllowed);
+ RegisterPropertyHandler("NextFocusDirection", UpdateFocusDirection);
+ RegisterPropertyHandler("NextFocusUpView", UpdateFocusUpView);
+ RegisterPropertyHandler("NextFocusDownView", UpdateFocusDownView);
+ RegisterPropertyHandler("NextFocusLeftView", UpdateFocusLeftView);
+ RegisterPropertyHandler("NextFocusRightView", UpdateFocusRightView);
+ RegisterPropertyHandler("NextFocusBackView", UpdateFocusBackView);
+ RegisterPropertyHandler("NextFocusForwardView", UpdateFocusForwardView);
+ RegisterPropertyHandler("ToolTip", UpdateToolTip);
}
RegisterPropertyHandler(VisualElement.AnchorXProperty, ApplyTransformation);
@@ -382,17 +381,17 @@ namespace Xamarin.Forms.Platform.Tizen
return;
}
- Action<VisualElementRenderer<TElement>, bool> init;
- if (s_propertyHandlersWithInit.TryGetValue(e.PropertyName, out init))
+ Action<bool> init;
+ if (_propertyHandlersWithInit.TryGetValue(e.PropertyName, out init))
{
- init(this, false);
+ init(false);
}
else
{
- Action<VisualElementRenderer<TElement>> handler;
- if (s_propertyHandlers.TryGetValue(e.PropertyName, out handler))
+ Action handler;
+ if (_propertyHandlers.TryGetValue(e.PropertyName, out handler))
{
- handler(this);
+ handler();
}
}
}
@@ -481,7 +480,7 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="property">Handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(BindableProperty property, Action<VisualElementRenderer<TElement>, bool> handler)
+ protected void RegisterPropertyHandler(BindableProperty property, Action<bool> handler)
{
RegisterPropertyHandler(property.PropertyName, handler);
}
@@ -491,9 +490,9 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="name">Name of the handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(string name, Action<VisualElementRenderer<TElement>, bool> handler)
+ protected void RegisterPropertyHandler(string name, Action<bool> handler)
{
- s_propertyHandlersWithInit.Add(name, handler);
+ _propertyHandlersWithInit.Add(name, handler);
}
/// <summary>
@@ -501,7 +500,7 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="property">Handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(BindableProperty property, Action<VisualElementRenderer<TElement>> handler)
+ protected void RegisterPropertyHandler(BindableProperty property, Action handler)
{
RegisterPropertyHandler(property.PropertyName, handler);
}
@@ -511,9 +510,9 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="name">Name of the handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(string name, Action<VisualElementRenderer<TElement>> handler)
+ protected void RegisterPropertyHandler(string name, Action handler)
{
- s_propertyHandlers.Add(name, handler);
+ _propertyHandlers.Add(name, handler);
}
/// <summary>
@@ -522,14 +521,14 @@ namespace Xamarin.Forms.Platform.Tizen
/// <param name="initialization">If set to <c>true</c> the method is called for an uninitialized object.</param>
protected void UpdateAllProperties(bool initialization)
{
- foreach (var action in s_propertyHandlersWithInit.Values.Distinct())
+ foreach (var action in _propertyHandlersWithInit.Values.Distinct())
{
- action(this, initialization);
+ action(initialization);
}
- foreach (var action in s_propertyHandlers.Values.Distinct())
+ foreach (var action in _propertyHandlers.Values.Distinct())
{
- action(this);
+ action();
}
}
@@ -989,11 +988,6 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
- private static void ApplyTransformation(VisualElementRenderer<TElement> renderer)
- {
- renderer.ApplyTransformation();
- }
-
protected virtual void ApplyTransformation()
{
if (null == NativeView)