本文整理汇总了C#中TabItem.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# TabItem.Focus方法的具体用法?C# TabItem.Focus怎么用?C# TabItem.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabItem
的用法示例。
在下文中一共展示了TabItem.Focus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnApplyTemplate
//.........这里部分代码省略.........
ScrollViewer scrollViewer = this.Template.FindName("PART_ScrollViewer", this) as ScrollViewer;
// set up event handlers for the RepeatButtons Click event
RepeatButton repeatLeft = this.Template.FindName("PART_RepeatLeft", this) as RepeatButton;
if (repeatLeft != null)
{
repeatLeft.Click += delegate
{
if (scrollViewer != null)
scrollViewer.LineLeft();
GC.Collect();
};
}
RepeatButton repeatRight = this.Template.FindName("PART_RepeatRight", this) as RepeatButton;
if (repeatRight != null)
{
repeatRight.Click += delegate
{
if (scrollViewer != null)
scrollViewer.LineRight();
GC.Collect();
};
}
// set up the event handler for the 'New Tab' Button Click event
ButtonBase button = this.Template.FindName("PART_NewTabButton", this) as ButtonBase;
if (button != null)
{
button.Click += delegate
{
VMukti.App.blnIsTwoPanel = false;
TabItem item = new TabItem();
item.Width = 250;
item.MinWidth = 250;
item.MaxWidth = 250;
item.OwnerID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
item.OwnerPageIndex = VMukti.App.pageCounter++;
ctlPgTabHeader objPgTabHeader = new ctlPgTabHeader();
// objPgTabHeader.Title = "New Page - " + this.Items.Count.ToString();
//TextBlock txtBlock = new TextBlock();
//txtBlock.Text = "New Tab - " + this.Items.Count.ToString();
if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP == VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName || VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == "")
{
objPgTabHeader.Title = "New Page";
}
else
{
objPgTabHeader.Title = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
}
Image imgIcon = new Image();
imgIcon.Source = new BitmapImage(new Uri(@"\Skins\Images\VMuktiIcon.ico", UriKind.RelativeOrAbsolute));
imgIcon.Height = 16;
imgIcon.Width = 16;
//item.Header = txtBlock;
item.Header = objPgTabHeader;
item.Icon = imgIcon;
item.Content = NewTabControl();
if (VMuktiAPI.VMuktiInfo.CurrentPeer.ID > 0)
{
item.AddBuddy(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
item.SetMaxCounter(0, VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
}
//if (i == -1 || i == this.Items.Count - 1 || AddNewTabToEnd)
this.Items.Add(item);
//else
//this.Items.Insert(++i, item);
if (SelectNewTabOnCreate)
{
SelectedItem = item;
VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
if (itemsHost != null)
itemsHost.MakeVisible(item, Rect.Empty);
item.Focus();
}
if (TabItemAdded != null)
TabItemAdded(this, new TabItemEventArgs(item));
};
this.Drop += new DragEventHandler(TabControl_Drop);
}
LoadDefaultPage();
objSendPageInfo = new DelSendPageInfo(SendPageInfo);
}
catch (Exception ex)
{
VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "OnapplyTemplate()", "Controls\\VMuktiGrid\\Page\\TabControl.cs");
}
}
示例2: LoadPage
public void LoadPage(int pageID, int confID)
{
try
{
VMukti.Business.VMuktiGrid.ClsPage objPage = VMukti.Business.VMuktiGrid.ClsPage.Get_PageInfo(pageID);
TabItem item = new TabItem();
item.ObjectID = pageID;
item.IsSaved = true;
item.OwnerID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
item.OwnerPageIndex = VMukti.App.pageCounter++;
item.ConfID = confID;
item.Width = 250;
item.MinWidth = 250;
item.MaxWidth = 250;
ctlPgTabHeader objPgTabHeader = new ctlPgTabHeader();
objPgTabHeader.Title = objPage.PageTitle;
//TextBlock txtBlock = new TextBlock();
//txtBlock.Text = "New Tab - " + this.Items.Count.ToString();
//Image imgIcon = new Image();
//imgIcon.Source = new BitmapImage(new Uri(@"\Skins\Images\VMuktiIcon.ico", UriKind.RelativeOrAbsolute));
//imgIcon.Height = 16;
//imgIcon.Width = 16;
//item.Header = txtBlock;
item.Header = objPgTabHeader;
// item.Icon = imgIcon;
item.Content = NewTabControl(pageID);
//this.ConfID = confID;
//if (i == -1 || i == this.Items.Count - 1 || AddNewTabToEnd)
#region Permission of rename or delet the page
if (pageID == 1 || pageID == 2)
{
item.CanDelete = false;
item.CanRename = false;
}
#endregion
this.Items.Add(item);
//else
//this.Items.Insert(++i, item);
if (SelectNewTabOnCreate)
{
// SelectedItem = item;
VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
if (itemsHost != null)
itemsHost.MakeVisible(item, Rect.Empty);
// item.Focus();
}
if (TabItemAdded != null)
TabItemAdded(this, new TabItemEventArgs(item));
item.Focus();
item.Loaded += new RoutedEventHandler(item_Loaded);
}
catch (Exception ex)
{
VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "LoadPage--2()", "Controls\\VMuktiGrid\\Page\\TabControl.cs");
}
}
示例3: SelectTabItem
internal bool SelectTabItem(TabItem ti)
{
var panel = Helper.FindVirtualizingTabPanel(this);
if (panel != null)
panel.MakeVisible(ti, Rect.Empty);
SelectedItem = ti;
var result = ti.Focus();
if (TabItemSelected != null)
TabItemSelected(this, new TabItemEventArgs(ti));
return result;
}
示例4: OnApplyTemplate
/*
* Protected override methods
*
*/
/// <summary>
/// OnApplyTemplate override
/// </summary>
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
// set up the event handler for the template parts
_toggleButton = this.Template.FindName("PART_DropDown", this) as ToggleButton;
if (_toggleButton != null)
{
// create a context menu for the togglebutton
System.Windows.Controls.ContextMenu cm = new ContextMenu();
cm.PlacementTarget = _toggleButton;
cm.Placement = PlacementMode.Bottom;
// create a binding between the togglebutton's IsChecked Property
// and the Context Menu's IsOpen Property
Binding b = new Binding();
b.Source = _toggleButton;
b.Mode = BindingMode.TwoWay;
b.Path = new PropertyPath(ToggleButton.IsCheckedProperty);
cm.SetBinding(ContextMenu.IsOpenProperty, b);
_toggleButton.ContextMenu = cm;
_toggleButton.Checked += DropdownButton_Checked;
}
ScrollViewer scrollViewer = this.Template.FindName("PART_ScrollViewer", this) as ScrollViewer;
// set up event handlers for the RepeatButtons Click event
RepeatButton repeatLeft = this.Template.FindName("PART_RepeatLeft", this) as RepeatButton;
if (repeatLeft != null)
{
repeatLeft.Click += delegate
{
if (scrollViewer != null)
scrollViewer.LineLeft();
GC.Collect();
};
}
RepeatButton repeatRight = this.Template.FindName("PART_RepeatRight", this) as RepeatButton;
if (repeatRight != null)
{
repeatRight.Click += delegate
{
if (scrollViewer != null)
scrollViewer.LineRight();
GC.Collect();
};
}
// set up the event handler for the 'New Tab' Button Click event
ButtonBase button = this.Template.FindName("PART_NewTabButton", this) as ButtonBase;
if (button != null)
{
button.Click += delegate
{
int i = this.SelectedIndex;
TabItem item = new TabItem();
item.Header = "New Tab";
if (i == -1 || i == this.Items.Count - 1 || AddNewTabToEnd)
this.Items.Add(item);
else
this.Items.Insert(++i, item);
if (SelectNewTabOnCreate)
{
SelectedItem = item;
VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
if (itemsHost != null)
itemsHost.MakeVisible(item, Rect.Empty);
item.Focus();
if (TabItemSelected != null)
TabItemSelected(this, new TabItemEventArgs(item));
}
if (TabItemAdded != null)
TabItemAdded(this, new TabItemEventArgs(item));
};
}
}