Example #1
0
        private void item_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var definition = ((sender as TreeViewItem).Tag as ExpressionDefinition);

            var instanceVM = new ExpressionInstanceVM(definition);
            var control    = new ExpressionControl {
                DataContext = instanceVM
            };
            var item = new TabItem
            {
                Tag     = definition.Name,
                Header  = definition.Name,
                Content = control
            };

            EventHandler closeHandler = null;

            closeHandler = (o, ea) =>
            {
                tabControl.Items.Remove(item);
                instanceVM.CloseRequested -= closeHandler;
            };
            instanceVM.CloseRequested += closeHandler;

            tabControl.Items.Add(item);
            item.Focus();
        }
Example #2
0
        private void item_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var definition = ((sender as TreeViewItem).Tag as ExpressionDefinition);

            var instanceVM = new ExpressionInstanceVM(definition);
            var control = new ExpressionControl {DataContext = instanceVM};
            var item = new TabItem
            {
                Tag = definition.Name,
                Header = definition.Name,
                Content = control
            };

            EventHandler closeHandler = null;
            closeHandler = (o, ea) =>
                               {
                                   tabControl.Items.Remove(item);
                                   instanceVM.CloseRequested -= closeHandler;
                               };
            instanceVM.CloseRequested += closeHandler;

            tabControl.Items.Add(item);
            item.Focus();
        }