using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Samples.Shared;

namespace Samples.GridView.SimulatedIndicatorColumn
{
    /// <summary>
    /// Interaction logic for MainPage.xaml
    /// </summary>
    public partial class MainPage : UserControl
    {
        private bool changingSelection;

        public MainPage()
        {
            InitializeComponent();

            this.radGridView.ItemsSource = SampleData.GetMessages();
        }

        private void Image_Loaded(object sender, RoutedEventArgs e)
        {
            Image image = (Image)sender;
            var parentRow = image.ParentOfType<GridViewRow>();

            Binding visibilityBinding = new Binding("IsSelected");
            visibilityBinding.Source = parentRow;
            Telerik.Windows.Controls.BooleanToVisibilityConverter converter = new Telerik.Windows.Controls.BooleanToVisibilityConverter();
            visibilityBinding.Converter = converter;

            image.SetBinding(Image.VisibilityProperty, visibilityBinding);
        }
    }
}
