﻿#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;
using zComp.Tools;
using System.Collections.ObjectModel;
using System.Collections;
using zComp.Wvg;
using zComp.ViewModel;

#endregion

namespace zComp.View.Vwg
{
    public partial class zBoolValueLookupFilterTemplate : UserControl
    {
        public zBoolValueLookupFilter _boolValueFilter = null;

        public zBoolValueLookupFilterTemplate()
            : base()
        {
            InitializeComponent();

            this.Draggable = new DraggableOptions(false);
            cbLabel.Draggable = new DraggableOptions(false);
        }

        public zBoolValueLookupFilter BoolValueFilter
        {
            get
            {
                return _boolValueFilter;
            }
            set
            {
                cbLabel.DataBindings.Clear();

                _boolValueFilter = value;

                if (_boolValueFilter != null)
                {
                    cbLabel.Text = _boolValueFilter.Label;
                    cbLabel.DataBindings.Add(new Binding(zComp.Tools.ExpressionHelper.GetPropertyName<zCheckBox>(el => el.Checked), _boolValueFilter, zComp.Tools.ExpressionHelper.GetPropertyName<zBoolValueLookupFilter>(el => el.Value), true, DataSourceUpdateMode.OnPropertyChanged));
//                    cbLabel.DataBindings.Add(new Binding(zComp.Tools.ExpressionHelper.GetPropertyName<zCheckBox>(el => el.Text), _boolValueFilter, zComp.Tools.ExpressionHelper.GetPropertyName<zBoolValueLookupFilter>(el => el.Label), true, DataSourceUpdateMode.OnPropertyChanged));
                }
            }
        }

    }
}