0

in my main view, I have a slider that can be used to scale the application.

<Slider x:Name="zoomSlider" VerticalAlignment="Center" Value="1" IsSnapToTickEnabled="True" TickFrequency="0.2" TickPlacement="Both" Minimum="0.5" Maximum="3" SmallChange="0.5" LargeChange="0.5" Width="100" />

and every control is scale-transformed accordingly:

<Controls:AutoHidePanel AutoHide="False" AutoFade="True" Height="50" Orientation="Horizontal">
            <Controls:AutoHidePanel.LayoutTransform>
                <ScaleTransform
                ScaleX="{Binding Value, ElementName=zoomSlider}"
                ScaleY="{Binding Value, ElementName=zoomSlider}"/>
            </Controls:AutoHidePanel.LayoutTransform>
            <MenuControl />
        </Controls:AutoHidePanel>

This works fine: like this every control in my windows scales fine.

Now, the MenuControl is a view that has a splitbutton, and this splitbutton uses a context menu to display sub items. The button itself scales too, but the context menu does not scale.

How can I make sure that this context menu scales together with its button control?

1 Answer 1

1

Meanwhile I found a solution. I just set the data context of the context menu to its parent data context like:

<ContextMenu DataContext="{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget.DataContext}">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.