+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
using System;
using System.Globalization;
internal class TemplateBinding : BindingBase
{
internal const string SelfPath = ".";
- IValueConverter _converter;
- object _converterParameter;
+ private IValueConverter converter;
+ private object converterParameter;
- BindingExpression _expression;
- string _path;
+ private BindingExpression expression;
+ private string path;
public TemplateBinding()
{
public IValueConverter Converter
{
- get { return _converter; }
+ get { return converter; }
set
{
ThrowIfApplied();
- _converter = value;
+ converter = value;
}
}
public object ConverterParameter
{
- get { return _converterParameter; }
+ get { return converterParameter; }
set
{
ThrowIfApplied();
- _converterParameter = value;
+ converterParameter = value;
}
}
public string Path
{
- get { return _path; }
+ get { return path; }
set
{
ThrowIfApplied();
- _path = value;
- _expression = GetBindingExpression(value);
+ path = value;
+ expression = GetBindingExpression(value);
}
}
{
base.Apply(fromTarget);
- if (_expression == null)
- _expression = new BindingExpression(this, SelfPath);
+ if (expression == null)
+ expression = new BindingExpression(this, SelfPath);
- _expression.Apply(fromTarget);
+ expression.Apply(fromTarget);
}
internal override async void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
{
base.Unapply(fromBindingContextChanged: fromBindingContextChanged);
- if (_expression != null)
- _expression.Unapply();
+ if (expression != null)
+ expression.Unapply();
}
void ApplyInner(Element templatedParent, BindableObject bindableObject, BindableProperty targetProperty)
{
- if (_expression == null && templatedParent != null)
- _expression = new BindingExpression(this, SelfPath);
+ if (expression == null && templatedParent != null)
+ expression = new BindingExpression(this, SelfPath);
- _expression?.Apply(templatedParent, bindableObject, targetProperty);
+ expression?.Apply(templatedParent, bindableObject, targetProperty);
}
BindingExpression GetBindingExpression(string path)