コード例 #1
0
 void viewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "ToolTipViewModel")
     {
         var toolTipView = new TaskToolTipView.TaskToolTipView();
         toolTipView.DataContext = ((ActiveTaskViewModel)DataContext).ToolTipViewModel;
         var toolTip = new ToolTip();
         toolTip.Content   = toolTipView;
         this.ToolTip      = toolTip;
         toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
     }
 }
コード例 #2
0
        /// <summary>
        /// Handles the DataContextChanged event of the ActiveTaskView control.
        /// This is a necessary hack, since the tooltip will only bind once. When the datacontext changes, it doesn't update.
        /// This is why it is reinstantiated programmatically
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        void DesktopTaskView_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            if (DataContext == null)
            {
                return;
            }
            var viewModel = (DesktopTaskViewModel)DataContext;

            var toolTipView = new TaskToolTipView.TaskToolTipView();

            toolTipView.DataContext = viewModel.ToolTipViewModel;
            var toolTip = new ToolTip();

            toolTip.Content   = toolTipView;
            this.ToolTip      = toolTip;
            toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
            toolTip.Padding   = new Thickness(0);
        }