using System.ComponentModel;
using Tizen.Xamarin.Forms.Extension;
using Tizen.Xamarin.Forms.Extension.Renderer;
-using Xamarin.Forms;\r
+using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;
using EColorSelector = ElmSharp.ColorSelector;
using TForms = Xamarin.Forms.Platform.Tizen.Forms;
-\r
-[assembly: ExportRenderer(typeof(ColorPickerView), typeof(ColorPickerViewRenderer))]
+
+[assembly: ExportRenderer(typeof(ColorSelector), typeof(ColorSelectorRenderer))]
namespace Tizen.Xamarin.Forms.Extension.Renderer
{
- public class ColorPickerViewRenderer : ViewRenderer<ColorPickerView, EColorSelector>
- {\r
- public ColorPickerViewRenderer()
+ public class ColorSelectorRenderer : ViewRenderer<ColorSelector, EColorSelector>
+ {
+ public ColorSelectorRenderer()
{
}
- protected override void OnElementChanged(ElementChangedEventArgs<ColorPickerView> e)
+ protected override void OnElementChanged(ElementChangedEventArgs<ColorSelector> e)
{
- if (Control == null)\r
- {\r
- var _colorSelector = new EColorSelector(TForms.Context.MainWindow);\r
+ if (Control == null)
+ {
+ var _colorSelector = new EColorSelector(TForms.Context.MainWindow);
SetNativeControl(_colorSelector);
}
- if (e.OldElement != null)\r
- {\r
- Control.ColorChanged -= ColorChangedHandler;\r
+ if (e.OldElement != null)
+ {
+ Control.ColorChanged -= ColorChangedHandler;
}
- if (e.NewElement != null)\r
- {\r
- UpdateSelectedColor();\r
- Control.ColorChanged += ColorChangedHandler;\r
+ if (e.NewElement != null)
+ {
+ UpdateSelectedColor();
+ Control.ColorChanged += ColorChangedHandler;
}
base.OnElementChanged(e);
- }\r
-\r
+ }
+
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
- {\r
- if (e.PropertyName == ColorPickerView.SelectedColorProperty.PropertyName)
- {\r
+ {
+ if (e.PropertyName == ColorSelector.SelectedColorProperty.PropertyName)
+ {
UpdateSelectedColor();
}
base.OnElementPropertyChanged(sender, e);
- }\r
-\r
+ }
+
void UpdateSelectedColor()
{
Control.SelectedColor = Element.SelectedColor.ToNative();
- }\r
-\r
- void ColorChangedHandler(object sender, ElmSharp.ColorChangedEventArgs e)\r
- {\r
- var color = Control.SelectedColor;\r
- Element.SelectedColor = Color.FromRgba(color.R, color.G, color.B, color.A);\r
- }\r
+ }
+
+ void ColorChangedHandler(object sender, ElmSharp.ColorChangedEventArgs e)
+ {
+ var color = Control.SelectedColor;
+ Element.SelectedColor = Color.FromRgba(color.R, color.G, color.B, color.A);
+ }
}
}
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<ItemGroup>\r
- <Compile Include="ColorPickerViewRenderer.cs" />\r
+ <Compile Include="ColorSelectorRenderer.cs" />\r
<Compile Include="MediaViewRenderer.cs" />\r
<Compile Include="DropdownListRenderer.cs" />\r
<Compile Include="BackgroundRenderer.cs" />\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Collections.ObjectModel;\r
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
using Xamarin.Forms;
namespace Tizen.Xamarin.Forms.Extension
-{\r
- /// <summary>\r
- /// The ColorPickerView class allows the user to select a color.\r
+{
+ /// <summary>
+ /// The ColorSelector class allows the user to select a color.
/// </summary>
/// <example>
/// <code>
- /// ColorPickerView colorPickerView = new ColorPickerView();\r
- /// colorPickerView.ColorChanged += (s, e) =>\r
- /// {\r
- /// Debug.WriteLine("Old Color: " + e.OldColor);\r
- /// Debug.WriteLine("New Color: " + e.NewColor);\r
- /// };\r
+ /// ColorSelector colorSelector = new ColorSelector();
+ /// colorSelector.ColorChanged += (s, e) =>
+ /// {
+ /// Debug.WriteLine("Old Color: " + e.OldColor);
+ /// Debug.WriteLine("New Color: " + e.NewColor);
+ /// };
/// </code>
/// </example>
- public class ColorPickerView : View
+ public class ColorSelector : View
{
- public static readonly BindableProperty SelectedColorProperty = BindableProperty.Create("SelectedColor", typeof(Color), typeof(ColorPickerView), Color.Default, propertyChanged: OnSelectedColorChanged );\r
-\r
- /// <summary>\r
- /// Get or set current selected color from ColorPickerView\r
- /// Default value is Color.Default\r
- /// </summary>\r
+ public static readonly BindableProperty SelectedColorProperty = BindableProperty.Create("SelectedColor", typeof(Color), typeof(ColorSelector), Color.Default, propertyChanged: OnSelectedColorChanged );
+
+ /// <summary>
+ /// Get or set current selected color from ColorSelector
+ /// Default value is Color.Default
+ /// </summary>
public Color SelectedColor
{
get { return (Color)GetValue(SelectedColorProperty); }
set { SetValue(SelectedColorProperty, value); }
}
- /// <summary>\r
- /// Occurs when the SelectedColor value changes\r
+ /// <summary>
+ /// Occurs when the SelectedColor value changes
/// </summary>
- public event EventHandler<ColorChangedEventArgs> ColorChanged;\r
-\r
- static void OnSelectedColorChanged(BindableObject bindable, object oldValue, object newValue)\r
- {\r
- var colorSelector = bindable as ColorPickerView;\r
- colorSelector.ColorChanged?.Invoke(colorSelector, new ColorChangedEventArgs(((Color)oldValue), (Color)newValue));\r
- }\r
+ public event EventHandler<ColorChangedEventArgs> ColorChanged;
+
+ static void OnSelectedColorChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var colorSelector = bindable as ColorSelector;
+ colorSelector.ColorChanged?.Invoke(colorSelector, new ColorChangedEventArgs(((Color)oldValue), (Color)newValue));
+ }
}
}
</PropertyGroup>\r
<ItemGroup>\r
<Compile Include="ColorChangedEventArgs.cs" />\r
- <Compile Include="ColorPickerView.cs" />\r
+ <Compile Include="ColorSelector.cs" />\r
<Compile Include="IMediaViewController.cs" />\r
<Compile Include="MediaView.cs" />\r
<Compile Include="Background.cs" />\r
<Target Name="AfterBuild">\r
</Target>\r
-->\r
-</Project>
+</Project>\r