public OperationItemControl(OperationTypes operation, bool isRoot)
        {
            InitializeComponent();

            RanetHotButton add = new RanetHotButton() { Margin = new Thickness(5, 0, 0, 0) };
            add.Click += new RoutedEventHandler(add_Click);
            add.Width = 18;
            add.Height = 18;
            add.Content = UiHelper.CreateIcon(UriResources.Images.AddHot16);
            LayoutRoot.Children.Add(add);
            Grid.SetColumn(add, 1);

            m_IsRoot = isRoot;
            operationControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;

            operationControl.SelectionChanged += new SelectionChangedEventHandler(operationControl_SelectionChanged);
            operationControl.DropDownClosed += new EventHandler(operationControl_DropDownClosed);

            InitItems();

            if (operationControl.Items.Count > 0)
            {
                operationControl.SelectedIndex = 0;
            }
        }
        public FilteredItemControl(Filtered_AreaItemWrapper wrapper, BitmapImage icon)
            : base(wrapper, icon)
        {
            m_FilterButton = new RanetHotButton();
            m_FilterButton.Click += new RoutedEventHandler(m_FilterButton_Click);
            m_FilterButton.Width = 18;
            m_FilterButton.Height = 18;
            m_FilterButton.Content = UiHelper.CreateIcon(UriResources.Images.FiltersArea16);
            LayoutRoot.Children.Add(m_FilterButton);
            Grid.SetColumn(m_FilterButton, 1);

            Refresh();
        }
        public SlicerCtrl()
        {
            viewer = new ScrollViewer();
            viewer.BorderThickness = new Thickness(0);
            viewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            viewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;                 
            Grid LayoutRoot = new Grid();
            m_DataGrid = new Grid();
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {Width = GridLength.Auto});
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {MaxWidth = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {MaxHeight = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition(){ Height = GridLength.Auto});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {Height = GridLength.Auto});
            m_Panel = new StackPanel();
            m_Panel.Orientation = Orientation.Horizontal;
            m_Clear = new RanetHotButton();
            m_Clear.Width = 20;
            m_Clear.Height = 20;
            m_Clear.Content = "C";
            m_Clear.Click +=new RoutedEventHandler(m_Clear_Click);
            m_Clear.Visibility = System.Windows.Visibility.Collapsed;
            LayoutRoot.Children.Add(m_Clear);
            Grid.SetRow(m_Clear,0);
            Grid.SetColumn(m_Clear,1);
            LayoutRoot.Children.Add(m_Panel);
            Grid.SetRow(m_Panel, 1);
            Grid.SetColumn(m_Panel, 0);
            LayoutRoot.Children.Add(m_DataGrid);
            Grid.SetColumn(m_DataGrid, 0);
            Grid.SetRow(m_DataGrid, 2);

            grdIsWaiting = new Grid() { Background = new SolidColorBrush(Color.FromArgb(125, 0xFF, 0xFF, 0xFF)) };
            grdIsWaiting.Visibility = Visibility.Collapsed;
            m_Waiting = new BusyControl();
            m_Waiting.Text = Localization.Loading;
            grdIsWaiting.Children.Add(m_Waiting);
            LayoutRoot.Children.Add(grdIsWaiting);
            Grid.SetColumnSpan(grdIsWaiting, LayoutRoot.ColumnDefinitions.Count > 0 ? LayoutRoot.ColumnDefinitions.Count : 1);
            Grid.SetRowSpan(grdIsWaiting, LayoutRoot.RowDefinitions.Count > 0 ? LayoutRoot.RowDefinitions.Count : 1);

            viewer.Content = LayoutRoot;
            this.Content = viewer;
            this.SlicerHeight = 10;
            this.SlicerWidth = 10;           
            //this.m_DataGrid.MouseLeftButtonDown += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonDown);
            //this.m_DataGrid.MouseLeftButtonUp += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonUp);
            this.DirectionChanged += new EventHandler<ChangedDirectionEventArgs>(SlicerCtrl_DirectionChanged);
            
            //this.m_Panel.MouseMove += new MouseEventHandler(m_Panel_MouseMove);
            //this.Content = m_DataGrid;
        }
        public OperandItemControl()
        {
            InitializeComponent();

            RanetHotButton remove = new RanetHotButton() { Margin = new Thickness(5, 0, 0, 0) };
            remove.Click += new RoutedEventHandler(remove_Click);
            remove.Width = 18;
            remove.Height = 18;
            remove.Content = UiHelper.CreateIcon(UriResources.Images.RemoveHot16);
            LayoutRoot.Children.Add(remove);
            Grid.SetColumn(remove, 3);

            conditionControl.Items.Add(new ConditionItemControl(ConditionTypes.Contains));
            conditionControl.Items.Add(new ConditionItemControl(ConditionTypes.Equal));
            conditionControl.Items.Add(new ConditionItemControl(ConditionTypes.BeginWith));
            conditionControl.SelectedIndex = 0;

            valueControl.KeyDown += new KeyEventHandler(valueControl_KeyDown);
        }
        public SlicerCtrl()
        {
            Grid LayoutRoot = new Grid();
            m_DataGrid = new Grid();
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {Width = GridLength.Auto});
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {MaxWidth = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {MaxHeight = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition(){ Height = GridLength.Auto});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {Height = GridLength.Auto});
            m_Panel = new StackPanel();
            m_Panel.Orientation = Orientation.Horizontal;
            RanetHotButton m_Clear = new RanetHotButton();
            m_Clear.Width = 20;
            m_Clear.Height = 20;
            m_Clear.Content = "C";
            m_Clear.Click +=new RoutedEventHandler(m_Clear_Click);
            LayoutRoot.Children.Add(m_Clear);
            Grid.SetRow(m_Clear,0);
            Grid.SetColumn(m_Clear,1);
            LayoutRoot.Children.Add(m_Panel);
            Grid.SetRow(m_Panel, 1);
            Grid.SetColumn(m_Panel, 0);
            LayoutRoot.Children.Add(m_DataGrid);
            Grid.SetColumn(m_DataGrid, 0);
            Grid.SetRow(m_DataGrid, 2);

            m_Waiting = new BusyControl();
            m_Waiting.Text = Localization.Loading;
            //LayoutRoot.Children.Add(m_Waiting);
            //Grid.SetRow(m_Waiting, 1);

            IsBusy = false;

            this.Content = LayoutRoot;
            //this.SlicerHeight = 9;
            //this.SlicerWidth = 9;           
            //this.m_DataGrid.MouseLeftButtonDown += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonDown);
            //this.m_DataGrid.MouseLeftButtonUp += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonUp);
            this.DirectionChanged += new EventHandler<ChangedDirectionEventArgs>(SlicerCtrl_DirectionChanged);
            //this.m_Panel.MouseMove += new MouseEventHandler(m_Panel_MouseMove);
            //this.Content = m_DataGrid;
        }
        public AreaItemControl()
        {
            LayoutRoot = new Grid();
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition());
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });

            Border border = new Border();
            border.BorderBrush = new SolidColorBrush(Colors.DarkGray);
            border.BorderThickness = new Thickness(1);
            border.Padding = new Thickness(2);
            border.Child = LayoutRoot;

            m_ItemCtrl = new HeaderControl();
            LayoutRoot.Children.Add(m_ItemCtrl);

            m_MoveUpButton = new RanetHotButton();
            m_MoveUpButton.Click += new RoutedEventHandler(m_MoveUpButton_Click);
            m_MoveUpButton.Width = 18;
            m_MoveUpButton.Height = 18;
            m_MoveUpButton.Content = UiHelper.CreateIcon(UriResources.Images.Up16);
            LayoutRoot.Children.Add(m_MoveUpButton);
            Grid.SetColumn(m_MoveUpButton, 2); 

            m_MoveDownButton = new RanetHotButton();
            m_MoveDownButton.Click += new RoutedEventHandler(m_MoveDownButton_Click);
            m_MoveDownButton.Width = 18;
            m_MoveDownButton.Height = 18;
            m_MoveDownButton.Content = UiHelper.CreateIcon(UriResources.Images.Down16);
            LayoutRoot.Children.Add(m_MoveDownButton);
            Grid.SetColumn(m_MoveDownButton, 3); 

            m_RemoveButton = new RanetHotButton();
            m_RemoveButton.Click += new RoutedEventHandler(m_RemoveButton_Click);
            m_RemoveButton.Width = 18;
            m_RemoveButton.Height = 18;
            m_RemoveButton.Content = UiHelper.CreateIcon(UriResources.Images.RemoveHot16);
            LayoutRoot.Children.Add(m_RemoveButton);
            Grid.SetColumn(m_RemoveButton, 4); 

            this.Content = border;

            LayoutRoot.AttachContextMenu(p => GetCurrentContextMenu(p));

            TooltipManager = new TooltipController(this);
            TooltipManager.BeforeOpen += new EventHandler<CustomEventArgs<Point>>(TooltipManager_BeforeOpen);
            TooltipManager.ToolTipContent = ToolTip;
        }