MindFusion.Wpf Pack Programmer's Guide
Popups

SchedulePopupContent

Item popups can be customized through the PopupStyle property of the BaseChart class.  To customize the appearance of the tooltips in the chart, assign a WPF Style with a custom ControlTemplate to this property. This Style targets the SchedulePopupContent class, which is used for the presentation of the popup. The default style of item popups in the default theme is displayed below:

XAML  Copy Code

<!-- SchedulePopupContent style -->
<Style TargetType="local:SchedulePopupContent">
  <Setter Property="BorderBrush" Value="{StaticResource PopupContentBorderBrush}" />
  <Setter Property="BorderThickness" Value="1" />
  <Setter Property="Background" Value="{StaticResource PopupContentBackgroundBrush}" />
  <Setter Property="Padding" Value="2" />
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="local:SchedulePopupContent">
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
          <StackPanel Orientation="Vertical">
            <StackPanel Name="NameContainer" Orientation="Horizontal">
              <TextBlock Text="{Binding DataContext.ActivityName}" FontWeight="Bold" />
              <TextBlock Text=" (" />
              <TextBlock Text="{Binding DataContext.ScheduleMode}" />
              <TextBlock Text=")" />
            </StackPanel>
            <StackPanel Name="StartTimeContainer" Orientation="Horizontal">
              <TextBlock Text="Start time: " />
              <TextBlock Text="{Binding ExpectedStartTime}" />
            </StackPanel>
            <StackPanel Name="EndTimeContainer" Orientation="Horizontal">
              <TextBlock Text="End time: " />
              <TextBlock Text="{Binding ExpectedEndTime}" />
            </StackPanel>
            <StackPanel Name="DurationContainer" Orientation="Horizontal">
              <TextBlock Text="Duration: " />
              <TextBlock Text="{Binding ExpectedDuration}" />
            </StackPanel>
            <StackPanel Name="ProgressContainer" Orientation="Horizontal" >
              <TextBlock Text="Progress: " />
             <TextBlock Text="{Binding ExpectedProgress}" />
            </StackPanel>
          </StackPanel>
        </Border>
        <ControlTemplate.Triggers>
          <Trigger Property="Action" Value="ResizeStart">
            <Setter TargetName="StartTimeContainer" Property="Visibility" Value="Visible" />
            <Setter TargetName="EndTimeContainer" Property="Visibility" Value="Collapsed" />
            <Setter TargetName="ProgressContainer" Property="Visibility" Value="Collapsed" />
          </Trigger>
          <Trigger Property="Action" Value="ResizeEnd">
            <Setter TargetName="StartTimeContainer" Property="Visibility" Value="Collapsed" />
            <Setter TargetName="EndTimeContainer" Property="Visibility" Value="Visible" />
            <Setter TargetName="ProgressContainer" Property="Visibility" Value="Collapsed" />
          </Trigger>
          <Trigger Property="Action" Value="Move">
            <Setter TargetName="StartTimeContainer" Property="Visibility" Value="Visible" />
            <Setter TargetName="EndTimeContainer" Property="Visibility" Value="Visible" />
           <Setter TargetName="ProgressContainer" Property="Visibility" Value="Collapsed" />
          </Trigger>
          <Trigger Property="Action" Value="ResizeProgress">
            <Setter TargetName="StartTimeContainer" Property="Visibility" Value="Collapsed" />
            <Setter TargetName="EndTimeContainer" Property="Visibility" Value="Collapsed" />
            <Setter TargetName="ProgressContainer" Property="Visibility" Value="Visible" />
          </Trigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

The template in the style relies on several static WPF Brush resources, which are defined differently across the themes. The local namespace prefix is defined to point to the http://mindfusion.eu/dataviews/wpf namespace. The control template defined in the style binds to various properties of the SchedulePopupContent class, including ExpectedStartTime, ExpectedEndTime, ExpectedDuration and ExpectedProgress. The DataContext of the SchedulePopupContent class property contains a reference to the underlying IActivityViewModel or IResourceAllocationViewModel depending on the actual item.

DependencyPopupContent

Dependency popups can be customized through the DependencyPopupStyle property of the ActivityChart class. You can customize the appearance of these tooltips by assigning a WPF Style with a custom ControlTemplate to this property. This Style targets the DependencyPopupContent class, which is used for the presentation of the popup. The default style of the dependency popups in the default theme is displayed below:

XAML  Copy Code

<!-- DependencyPopupContent style -->
<Style TargetType="local:DependencyPopupContent">
  <Setter Property="BorderBrush" Value="{StaticResource PopupContentBorderBrush}" />
  <Setter Property="BorderThickness" Value="1" />
  <Setter Property="Background" Value="{StaticResource PopupContentBackgroundBrush}" />
  <Setter Property="Padding" Value="2" />
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="local:DependencyPopupContent">
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
          <StackPanel Orientation="Vertical">
            <TextBlock Text="{TemplateBinding PopupTitle}" FontWeight="Bold" Margin="0,0,0,3"/>
            <Line X1="0" X2="1" Y1="0" Y2="0" Stretch="Fill" Stroke="Black" StrokeThickness="1.5" Margin="0,0,0,3"/>
            <StackPanel Name="FromContainer" Orientation="Horizontal">
              <TextBlock Text="From: " />
              <TextBlock Text="{TemplateBinding From}" FontWeight="Bold" />
            </StackPanel>
            <StackPanel Name="ToContainer" Orientation="Horizontal">
              <TextBlock Text="To: " />
              <TextBlock Text="{TemplateBinding To}" FontWeight="Bold"/>
            </StackPanel>
            <StackPanel Name="DependencyTypeContainer" Orientation="Horizontal">
              <TextBlock Text="Dependency type: " />
              <TextBlock Text="{TemplateBinding FromType}" FontWeight="Bold" />
              <TextBlock Text="To" FontWeight="Bold" />
              <TextBlock Text="{TemplateBinding ToType}" FontWeight="Bold" />
            </StackPanel>
          </StackPanel>
        </Border>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

As with the SchedulePopupContent default style, this style also relies on several static WPF Brush resources, which are defined differently in different themes. The local namespace prefix is defined to point to http://mindfusion.eu/dataviews/wpf namespace.The ControlTemplate defined in the style binds to various properties of the DependencyPopupContent class, including PopupTitle, From, To, FromType and ToType.