private void OpenServerObjectItemDetailsUserControl(TabItemEventArgs AEventArgs) { try { BitmapImage LBitmapImageShow = new BitmapImage(new Uri(System.IO.Path.Combine(App.GStrApplicationDirectory, @"Images\00000013.ico"), UriKind.RelativeOrAbsolute)); Image LImageTabItem = new Image(); LImageTabItem.Width = 16; LImageTabItem.Height = 16; LImageTabItem.Source = LBitmapImageShow; LImageTabItem.Margin = new Thickness(2, 0, 2, 0); AEventArgs.TabItem.Icon = LImageTabItem; TextBlock LTextBlockHeader = new TextBlock(); LTextBlockHeader.Style = (Style)App.Current.Resources["TextBlockNormalStyle"]; LTextBlockHeader.TextTrimming = TextTrimming.CharacterEllipsis; LTextBlockHeader.TextWrapping = TextWrapping.NoWrap; LTextBlockHeader.Text = App.GetDisplayCharater("M01012"); AEventArgs.TabItem.Header = LTextBlockHeader; AEventArgs.TabItem.Tag = App.GetDisplayCharater("M01011"); AEventArgs.TabItem.AllowDelete = false; ITabItemServerObjectDetail = AEventArgs.TabItem; LabelCurrentObjectPath.Content = App.GetDisplayCharater("M01011"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void LTabControlMainPanel_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { YoungWPFTabControl.TabControl LTabControl = (YoungWPFTabControl.TabControl)e.Source; YoungWPFTabControl.TabItem LTabItem = (YoungWPFTabControl.TabItem)LTabControl.SelectedItem; LabelCurrentObjectPath.Content = LTabItem.Tag.ToString(); } catch { } }
private System.Windows.Forms.WebBrowser GetCurrentWebBrowser() { YoungWPFTabControl.TabItem item = tabControl.SelectedItem as YoungWPFTabControl.TabItem; if (item == null) { return(null); } WindowsFormsHost host = item.Content as WindowsFormsHost; if (host == null) { return(null); } System.Windows.Forms.WebBrowser browser = host.Child as System.Windows.Forms.WebBrowser; return(browser); }
void Browser_DocumentTitleChanged(object sender, EventArgs e) { System.Windows.Forms.WebBrowser browser = sender as System.Windows.Forms.WebBrowser; if (browser == null) { return; } // update the TabItems's Header property YoungWPFTabControl.TabItem item = tabControl.SelectedItem as YoungWPFTabControl.TabItem; // Add an Icon to the tabItem BitmapImage image = new BitmapImage(new Uri("pack://application:,,,/Test;component/Images/ie.ico")); Image img = new Image(); img.Source = image; img.Width = 16; img.Height = 16; img.Margin = new Thickness(2, 0, 2, 0); if (item != null) { item.Icon = img; } // wrap the header in a textblock, this gives us the character ellipsis (...) when trimmed TextBlock tb = new TextBlock(); tb.Text = browser.DocumentTitle; tb.TextTrimming = TextTrimming.CharacterEllipsis; tb.TextWrapping = TextWrapping.NoWrap; if (item != null) { item.Header = tb; } }