Code refactored with XAML binding