Conversion Problem from v14.2.610.0 to v16.1.0633.

Docking/MDI for WPF Forum

Posted 3 years ago by Roger
Version: 16.1.0633
Avatar

I'm try to update DockSite from v14.2.610.0 to v16.1.0633.
1.We used custom switcher style.
There are build errors. Because there is no SwitcherListBox and SwitcherGridListBox.
Whrere it has gone? I could not find in the document.
How to replace these style?
<Style x:Key="{x:Type docking:SwitcherGridListBox}" TargetType="{x:Type docking:SwitcherGridListBox}"
BasedOn="{StaticResource {x:Type docking:SwitcherListBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type docking:SwitcherGridListBox}">
<Grid>
<ItemsPresenter />
<RepeatButton Width="{TemplateBinding ItemWidth}" Height="{TemplateBinding ItemHeight}" Command="ScrollBar.LineUpCommand"
Style="{StaticResource SwitcherGridListBoxRepeaterButtonStyle}"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CanScrollUp, Converter={StaticResource BooleanToVisibilityConverter}}"
VerticalAlignment="Top" HorizontalAlignment="Left">
<Path Width="9" Height="5" Data="M 0 5 L 4.5 0 L 9 5 Z" Fill="{TemplateBinding Foreground}" />
</RepeatButton>
<RepeatButton Width="{TemplateBinding ItemWidth}" Height="{TemplateBinding ItemHeight}" Command="ScrollBar.LineDownCommand"
Style="{StaticResource SwitcherGridListBoxRepeaterButtonStyle}"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CanScrollDown, Converter={StaticResource BooleanToVisibilityConverter}}"
VerticalAlignment="Bottom" HorizontalAlignment="Right">
<Path Width="9" Height="5" Data="M 0 0 L 4.5 5 L 9 0 Z" Fill="{TemplateBinding Foreground}" />
</RepeatButton>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2. TabbedMdiContainer.SelectedContent and RaftedDocumentWindowContainer also disappeared.
How should I replace following code?
private static FrameworkElement GetView(FrameworkElement element)
{
FrameworkElement view = null;
var tabContainer = GetVisualParent<TabbedMdiContainer>(element);
if (tabContainer != null)
{
view = tabContainer.SelectedWindow as FrameworkElement;
}
else
{
var raftedContainer = GetVisualParent<DockingWindowContainerBase>(element);
if (raftedContainer != null)
{
view = raftedContainer.SelectedWindow as FrameworkElement;
}
}
return view;
}

3.I binded ToolWindow Tile and ImageSource to CustomToolWindow which is derived from ToolWindow.
How to replace the binding?

Comments (3)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Roger,

I believe your company has a WPF Studio license so whoever is listed on the account can download the default styles/templates for the 2016.1 version from your organization's account page on our site.  I'd recommend you start there.  For the 2016.1 version, we completely rewrote the product, adding a lot of major new features along the way and making the internals much better.  While much of the public API is the same or similar, there are some breaking changes.  Notably, all of the styles/templates were redesigned to be simpler and easier to customize.  If you have those default styles/templates, then you can see how they look for the new version.

1) Those controls aren't used any more in the switcher.  StandardSwitcher's style is a lot more straightforward to customize now, but you will need the default style/template to see how to customize it.

2) Part of the updates was making the DocumentWindow and ToolWindow controls actually be the containers in UI of their own content.  In the old version, they rendered themselves in UI as tabs.  In the new version, separate tabs still represent them but the docking windows are the parent of their child content.  So instead of walking up to look for a TabbedMdiContainer, etc., just look for a DocumentWindow.

3) Sorry but I'm not sure what you mean here.  Could you provide more detail? 


Actipro Software Support

Posted 3 years ago by Roger
Avatar

3) We have CustomToolWindow class which derives from the ToolWindow.

/// <summary>
/// For customize toolWindow
/// </summary>
/// <seealso cref="ActiproSoftware.Windows.Controls.Docking.ToolWindow" />
public class CustomToolWindow : ToolWindow
{
/// <summary>
/// Initializes a new instance of the <see cref="CustomToolWindow"/> class.
/// </summary>
public CustomToolWindow()
{
this.DefaultDockDirection = Direction.Bottom;
this.AllowDrop = false;
}

/// <summary>
/// Gets or sets the default dock direction.
/// </summary>
public Direction DefaultDockDirection { get; set; }

/// <summary>
/// Gets or sets the default dock group.
/// </summary>
public string DefaultDockGroup { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this instance is initially automatic hidden.
/// </summary>
public bool IsInitiallyAutoHidden { get; set; }

/// <summary>
/// Gets or sets the default dock relative group.
/// </summary>
public string DefaultDockRelativeGroup { get; set; }

}

 

This is xaml and we bind the properties between the Title and DrawingImage and the ViewModel.

We have build error on Title="{Binding Path=TranslatedText}".

<common:CustomToolWindow x:Class="ToolWindowView"

Title="{Binding Path=TranslatedText}"
DefaultDockGroup="ToolGroup4"
DefaultDockDirection="Bottom"
IsInitiallyAutoHidden="False"
>
<common:CustomToolWindow.ImageSource>
<DrawingImage Drawing="{Binding Drawing, Source={StaticResource build}}" />
</common:CustomToolWindow.ImageSource> 

[Modified 3 years ago]

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Roger,

Any Binding like that should not cause a build error.  I can see it showing a binding error in the VS Output at runtime if the DataContext inherited down to the ToolWindow doesn't have that property when the binding tries to execute.  But that shouldn't stop the app itself, it would just prevent the value from showing up properly.  Assuming you are setting the CustomToolWindow.DataContext at some point after the XAML loads, I would expect to see binding errors for the bindings in your XAML (since there is no data context yet and the bindings are executing) and then after the DataContext is set, the data woudl populate.

If you aren't using our MVVM features (DockSite.ToolItemsSource, etc.) then a better way would be to peraps create this tool window instance in code and set the DataContext to your VM before you ever open it (and thus load the XAML) in UI.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.