Problem

Binding Error with ZoomContentControl, sample usage

Posted 3 years ago by Avatar Justin Klein

I've got a simple docking/MDI application where each tab shows an image.  When I tried wrapping each image in a ZoomContentControl, it yielded the error:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='ActiproSoftware.Windows.Controls.Navigation.ZoomDecorator', AncestorLevel='1''. BindingExpression:Path=ZoomLevelAnimated; DataItem=null; target element is 'ScaleTransform' (HashCode=3499754); target property is 'ScaleX' (type 'Double')

 However, functionality of the zoom control works as expected.  What might be causing this message to appear?

 

Some code:

    <Window.Resources>
        <Style x:Key="DocumentItemStyle" TargetType="docking:DocumentWindow">
            <Setter Property="Title" Value="{Binding Title}" />
            <Setter Property="FileName" Value="{Binding Filename}" />
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <navigation:ZoomContentControl IsPanPadVisible="False" IsResetViewButtonVisible="False">
                            <shared:ActiproLogo />
                        </navigation:ZoomContentControl>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

 

        <docking:DockSite
                          sampleCommon:DockSiteViewModelBehavior.IsManaged="true" 
                          DocumentItemsSource="{Binding DocumentItems}"
                          DocumentItemContainerStyle="{StaticResource DocumentItemStyle}" >
            <docking:Workspace>
                <docking:TabbedMdiHost />
            </docking:Workspace>
        </docking:DockSite>

Comments (6)

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

Hi Justin,

Thanks for reporting this.  We tried numerous things to eliminate the binding warning but were unable to completely due to the bindings that are needed for scale transform.  We were however able to change things so that it doesn't show unless you use an overlay, which should help you in your scenario, since you probably don't use overlays.


Actipro Software Support
Posted 3 years ago by Justin Klein

We were however able to change things so that it doesn't show unless you use an overlay, which should help you in your scenario

Good to hear - so what would I need to do to avoid the error showing on my end?  Does "change things so it doesn't show" refer to a newer build that's not yet publicly available, or to changes I could make on my end right now?

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

It's due to internal changes that aren't yet available until the next maintenance release.  The only thing you could do in the meantime is clone and alter the template for the control to remove the overlay display portions in the template.


Actipro Software Support
Posted 3 years ago by Justin Klein

K, I suppose I'll just wait for now then.

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

Incidentally, there's nothing wrong with the binding as-is.  The binding warning is just intially showing in the console output before the visual tree is fully constructed.  While that message may be annoying to look at in VS, the run-time functionality works fine since the binding does find the proper ancestor after the visual tree gets loaded.


Actipro Software Support
Posted 3 years ago by Justin Klein

Yup, I saw that it's working properly - just trying to cut down on the output so that other more relevant errors don't go unnoticed or get pushed outside of the window.

Information The latest build of this product (2018.1 build 0674) was released 5 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.