private Binding CreateBinding(IResourceContext context, BindingProxy proxy)
 {
     return(new Binding
     {
         Source = proxy,
         Path = new PropertyPath(BindingProxy.ValueProperty),
         Converter = GetValueConverter(context),
         Mode = BindingMode.OneWay
     });
 }
        public override BindingBase ProvideBinding(IResourceContext context)
        {
            var key = new DynamicResourceKey(ResourceKey);

            if (context.TryFindResource(key) is BindingProxy proxy)
            {
                return(CreateBinding(context, proxy));
            }

            proxy = new BindingProxy();
            context.AddResource(key, proxy);
            proxy.Value = new DynamicResourceExtension(ResourceKey).ProvideValue(new Target(context));
            return(CreateBinding(context, proxy));
        }