public void Add(CompleteInfo completeInfo) { try { AdornerContentPresenter adorner = new AdornerContentPresenter(DisplayArea, completeInfo.Display); _AdornerLayerManager.Add(completeInfo.Name, adorner); _AdornerLayerManager.Show(completeInfo.Name); CompleteInfoLinks.Children.Add(completeInfo.Link); } catch (Exception ex) { _Logger.LogError(ex); } }
private static void SetContent(object sender, DependencyPropertyChangedEventArgs e) { var textBox = sender as TextBox; if (textBox != null) { textBox.Loaded += delegate { var placeHolder = CreatePlaceHolderUiElement(textBox, e.NewValue.ToString()); placeHolder.MouseDown += delegate { textBox.Focus(); }; textBox.TextChanged += delegate { if (string.IsNullOrEmpty(textBox.Text)) { placeHolder.Visibility = Visibility.Visible; } else { placeHolder.Visibility = Visibility.Collapsed; } }; textBox.GotFocus += delegate { placeHolder.Visibility = Visibility.Collapsed; }; textBox.LostFocus += delegate { if (string.IsNullOrEmpty(textBox.Text)) { placeHolder.Visibility = Visibility.Visible; } }; var adorner = new AdornerContentPresenter(textBox, placeHolder); AdornerLayer.GetAdornerLayer(textBox).Add(adorner); }; } }
private static void SetContent(object sender, DependencyPropertyChangedEventArgs e) { var element = sender as FrameworkElement; if (element != null) { element.Loaded += delegate { var content = e.NewValue as FrameworkElement; content.HorizontalAlignment = HorizontalAlignment.Right; content.Margin = new Thickness(4); var adorner = new AdornerContentPresenter(element, content); AdornerLayer.GetAdornerLayer(element).Add(adorner); }; } }
public FrameWork(EventLoggerAccess logger) { try { InitializeComponent(); CultureResources.registerDataProvider(this); _Logger = logger; _StatusInfoDisplay = new StatusInfoDisplay(logger); _StatusAdorner = new AdornerContentPresenter(DisplayArea, _StatusInfoDisplay); _AboutBox = new AboutBox(); _AboutAdorner = new AdornerContentPresenter(DisplayArea, _AboutBox); _AdornerLayerManager = new AdornerLayerManager(AdornerLayer.GetAdornerLayer(DisplayArea)); _WidgetPages = new List <WidgetPage>(); } catch { } }