Skip to content

Instantly share code, notes, and snippets.

@oskar-szulc
Last active October 1, 2015 19:20
Show Gist options
  • Save oskar-szulc/bcc25beed98c809539ec to your computer and use it in GitHub Desktop.
Save oskar-szulc/bcc25beed98c809539ec to your computer and use it in GitHub Desktop.
private PropertyBinding _bindingClass;
private void RefreshSourceProperties()
{
if (_bindingClass.Source == null) return;
var tempSource = from sourceProp in _bindingClass.Source.GetType().GetProperties(BindingFlags.DeclaredOnly |
BindingFlags.Public |
BindingFlags.Instance)
select sourceProp;
_sourceProperties = tempSource.ToList();
}
private void RefreshTargetProperties()
{
if (_bindingClass.Target == null || _bindingClass.Source == null) return;
var tempTarget = from targetProp in _bindingClass.Target.GetType().GetProperties(BindingFlags.DeclaredOnly |
BindingFlags.Public |
BindingFlags.Instance)
where targetProp.PropertyType.IsAssignableFrom(_bindingClass.SourceProperty.PropertyType) ||
targetProp.PropertyType == typeof(string)
select targetProp;
_targetProperties = tempTarget.ToList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment