/// <summary>Bind to a specified property with inline conversion</summary> /// <param name="pathExpression">viewModel.Property or viewModel.Property1.Property2 or (SomeExpression.viewModel).Property <br />?. can be used safely - viewmodel instance is not required</param> public static TDependencyObject Bind <TDependencyObject, TPropertyValue, TSource>( this DependencyProperty <TDependencyObject, TPropertyValue> property, object pathExpression = null, BindingMode mode = BindingMode.Default, Func <TSource, TPropertyValue> convert = null, Func <TPropertyValue, TSource> convertBack = null, string converterLanguage = null, UpdateSourceTrigger updateSourceTrigger = UpdateSourceTrigger.Default, object source = null, TPropertyValue targetNullValue = default, [CallerArgumentExpression("pathExpression")] string pathExpressionString = default ) where TDependencyObject : DependencyObject => property.BindWithString( Helpers.BindingExpressionToPath(pathExpressionString), mode, new FuncConverter <TSource, TPropertyValue, object>(convert, convertBack), null, converterLanguage, updateSourceTrigger, source, targetNullValue );
const string bindingContextPath = ""; // TODO: Find framework static var for this // TODO: Check how much overhead having all these generics introduces (app size binary bloat in eg wasm?) /// <summary>Bind to a specified property</summary> /// <param name="pathExpression">viewModel.Property or viewModel.Property1.Property2 or (SomeExpression.viewModel).Property <br />?. can be used safely - viewmodel instance is not required</param> public static TDependencyObject Bind <TDependencyObject, TPropertyValue>( this DependencyProperty <TDependencyObject, TPropertyValue> property, object pathExpression = null, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null, string converterLanguage = null, UpdateSourceTrigger updateSourceTrigger = UpdateSourceTrigger.Default, object source = null, TPropertyValue targetNullValue = default, TPropertyValue fallbackValue = default, [CallerArgumentExpression("pathExpression")] string pathExpressionString = default ) where TDependencyObject : DependencyObject => property.BindWithString( Helpers.BindingExpressionToPath(pathExpressionString), mode, converter, converterParameter, converterLanguage, updateSourceTrigger, source, targetNullValue, fallbackValue );