return instance.valueIndicatorText.Text;
});
+ /// <summary>
+ /// Bindable property of CurrentValue
+ /// <remark>
+ /// Hidden API, used for NUI XAML data binding
+ /// </remark>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CurrentValueProperty = BindableProperty.Create(nameof(CurrentValue), typeof(float), typeof(Slider), 0.0f, BindingMode.TwoWay,
+ propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var instance = (Slider)bindable;
+
+ if (newValue != null)
+ {
+ instance.curValue = (float)newValue;
+ if (instance.IsHighlighted)
+ {
+ instance.EmitAccessibilityEvent(ObjectPropertyChangeEvent.Value);
+ }
+ instance.UpdateValue();
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var instance = (Slider)bindable;
+ return instance.curValue;
+ }
+ );
+
static Slider() { }
/// <summary>
{
get
{
- return curValue;
+ return (float)GetValue(CurrentValueProperty);
}
set
{
- curValue = value;
- if (IsHighlighted)
- {
- EmitAccessibilityEvent(ObjectPropertyChangeEvent.Value);
- }
- UpdateValue();
+ SetValue(CurrentValueProperty, value);
}
}
if (currentSlidedOffset <= 0)
{
- curValue = minValue;
+ this.CurrentValue = minValue;
}
else if (currentSlidedOffset >= BgTrackLength())
{
- curValue = maxValue;
+ this.CurrentValue = maxValue;
}
else
{
int bgTrackLength = BgTrackLength();
if (bgTrackLength != 0)
{
- curValue = ((currentSlidedOffset / (float)bgTrackLength) * (float)(maxValue - minValue)) + minValue;
+ this.CurrentValue = ((currentSlidedOffset / (float)bgTrackLength) * (float)(maxValue - minValue)) + minValue;
}
}
if (IsDiscrete)
{
- curValue = CalculateDiscreteValue(curValue);
+ this.CurrentValue = CalculateDiscreteValue(this.CurrentValue);
}
if (valueChangedHandler != null)
{
ValueChangedArgs args = new ValueChangedArgs();
- args.CurrentValue = curValue;
+ args.CurrentValue = this.CurrentValue;
valueChangedHandler(this, args);
}
if (sliderValueChangedHandler != null)
{
SliderValueChangedEventArgs args = new SliderValueChangedEventArgs();
- args.CurrentValue = curValue;
+ args.CurrentValue = this.CurrentValue;
sliderValueChangedHandler(this, args);
}
}
if (bgTrackLength != 0)
{
- curValue = ((currentSlidedOffset / (float)bgTrackLength) * (maxValue - minValue)) + minValue;
+ this.CurrentValue = ((currentSlidedOffset / (float)bgTrackLength) * (maxValue - minValue)) + minValue;
if (IsDiscrete)
{
- curValue = CalculateDiscreteValue(curValue);
+ this.CurrentValue = CalculateDiscreteValue(this.CurrentValue);
}
if (null != valueChangedHandler)
{
ValueChangedArgs args = new ValueChangedArgs();
- args.CurrentValue = curValue;
+ args.CurrentValue = this.CurrentValue;
valueChangedHandler(this, args);
}
if (null != sliderValueChangedHandler)
{
SliderValueChangedEventArgs args = new SliderValueChangedEventArgs();
- args.CurrentValue = curValue;
+ args.CurrentValue = this.CurrentValue;
sliderValueChangedHandler(this, args);
}
}
set
{
SetValue(TextProperty, value);
- selectorData?.Text?.Reset(this);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(FontFamilyProperty, value);
- selectorData?.FontFamily?.Reset(this);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(FontStyleProperty, value);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(PointSizeProperty, value);
- selectorData?.PointSize?.Reset(this);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(MultiLineProperty, value);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(LineSpacingProperty, value);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(PixelSizeProperty, value);
- selectorData?.PixelSize?.Reset(this);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
set
{
SetValue(MinLineSizeProperty, value);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
}
SetValue(FontSizeScaleProperty, newFontSizeScale);
- NotifyPropertyChangedAndRequestLayout();
+ NotifyPropertyChanged();
}
}
{
float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
SetValue(FontSizeScaleProperty, newFontSizeScale);
- NotifyPropertyChangedAndRequestLayout();
}
private void addFontSizeChangedCallback()
}
}
- private void NotifyPropertyChangedAndRequestLayout()
+ private void RequestLayout()
{
- NotifyPropertyChanged();
Layout?.RequestLayout();
}
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.TEXT, new Tizen.NUI.PropertyValue((string)newValue));
+ textLabel.selectorData?.Text?.Reset(textLabel);
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.FontFamily, new Tizen.NUI.PropertyValue((string)newValue));
+ textLabel.selectorData?.FontFamily?.Reset(textLabel);
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.FontStyle, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.PointSize, new Tizen.NUI.PropertyValue((float)newValue));
+ textLabel.selectorData?.PointSize?.Reset(textLabel);
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.MultiLine, new Tizen.NUI.PropertyValue((bool)newValue));
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.LineSpacing, new Tizen.NUI.PropertyValue((float)newValue));
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.PixelSize, new Tizen.NUI.PropertyValue((float)newValue));
+ textLabel.selectorData?.PixelSize?.Reset(textLabel);
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.MinLineSize, new Tizen.NUI.PropertyValue((float)newValue));
+ textLabel.RequestLayout();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
using (var property = new Tizen.NUI.PropertyValue((float)newValue))
{
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.FontSizeScale, property);
+ textLabel.RequestLayout();
}
}
}),
[STAThread]
static void Main(string[] args)
{
+ //new TextLayoutSample().Run(args);
//new TempTest().Run(args);
new LayoutSample().Run(args);
--- /dev/null
+
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Examples
+{
+ public partial class TextLayoutPage : View
+ {
+ public TextLayoutPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
--- /dev/null
+
+using Tizen.NUI;
+
+namespace Tizen.NUI.Examples
+{
+ using log = Tizen.Log;
+ public class TextLayoutSample : NUIApplication
+ {
+ private const string tag = "NUITEST";
+ TextLayoutPage page;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ Window window = Window.Instance;
+ window.BackgroundColor = Color.Cyan;
+ window.KeyEvent += OnKeyEvent;
+
+ page = new TextLayoutPage();
+ page.PositionUsesPivotPoint = true;
+ page.ParentOrigin = ParentOrigin.Center;
+ page.PivotPoint = PivotPoint.Center;
+ page.Size = new Size(720, 1280, 0);
+ window.Add(page);
+
+ //page.text.PropertyChanged += TextPropertyChanged;
+ //page.text2.PropertySet += TextPropertySet;
+ }
+
+ private void TextPropertySet(object sender, global::System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ log.Debug(tag, $"TextPropertySet() name={e.PropertyName} ");
+ }
+
+ private void TextPropertyChanged(object sender, global::System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ log.Debug(tag, $"TextPropertyChanged() name={e.PropertyName} ");
+ }
+
+ public void OnKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ //log.Debug(tag, $"OnKeyEvent() {e.Key.KeyPressedName}, page.slider.CurrentValue={page.slider.CurrentValue}");
+ if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
+ {
+ Exit();
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<View x:Class="Tizen.NUI.Examples..TextLayoutPage"
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:a="clr-namespace:Tizen.NUI;assembly=Tizen.NUI"
+ xmlns:b="clr-namespace:Tizen.NUI.BaseComponents;assembly=Tizen.NUI"
+ xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
+
+ <c:Slider x:Name="slider" Position2D="50,30" Size2D="500,50" BackgroundColor="Yellow" MaxValue="600" MinValue="100"/>
+
+ <b:View x:Name="view" SizeWidth="{Binding Source={x:Reference Name=slider}, Path=CurrentValue}" SizeHeight="500" Position2D="10,100"
+ HeightSpecification="-2">
+
+ <b:View.Layout>
+ <a:GridLayout Rows="2" GridOrientation="Horizontal"/>
+ </b:View.Layout>
+
+ <b:TextLabel x:Name="text" Text="this is text LineWrapMode=Character, Long loooooooooooooooooong!" BackgroundColor="Red"
+ TextColor="White" MultiLine="True" LineWrapMode="Character" WidthSpecification="-1" HeightSpecification="-2" />
+
+ <b:TextLabel x:Name="text2" Text="this is text2 LineWrapMode=Word, Long loooooooooooooooooong!" BackgroundColor="Blue"
+ TextColor="White" MultiLine="True" LineWrapMode="Word" WidthSpecification="-1" HeightSpecification="-2" />
+
+ </b:View>
+
+</View>