Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save atzimler/0a049ae722dec744f0594c16d61d97b1 to your computer and use it in GitHub Desktop.

Select an option

Save atzimler/0a049ae722dec744f0594c16d61d97b1 to your computer and use it in GitHub Desktop.
public class CreateResultStars
{
private readonly MultiplyByTwo _multiplier;
public string Stars { get; private set; }
public CreateResultStars(MultiplyByTwo multiplier)
{
_multiplier = multiplier;
var dpd = DependencyPropertyDescriptor.FromProperty(MultiplyByTwo.ResultProperty, typeof(MultiplyByTwo));
dpd.AddValueChanged(_multiplier, (o, e) => RecalculateStars());
RecalculateStars();
}
private void RecalculateStars()
{
Stars = new string('*', _multiplier.Result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment