ImageViewerAddOn and custom user control vertical stretch

Hi, I’d love to create an overlay to the standard built-in camera viewer by using the ordinary ImageViewerAddOn. Since the layout of the overlay might get a bit complex, I’d like to use XAML. The buttons added to the overlay seem not to strech vertically

XAML

<UserControl x:Class=“ActiveElementsOverlay.Background.UserControl1”

   xmlns="[http://schemas.microsoft.com/winfx/2006/xaml/presentation](http://schemas.microsoft.com/winfx/2006/xaml/presentation "http://schemas.microsoft.com/winfx/2006/xaml/presentation")"

   xmlns:x="[http://schemas.microsoft.com/winfx/2006/xaml](http://schemas.microsoft.com/winfx/2006/xaml "http://schemas.microsoft.com/winfx/2006/xaml")"

   xmlns:mc="[http://schemas.openxmlformats.org/markup-compatibility/2006](http://schemas.openxmlformats.org/markup-compatibility/2006 "http://schemas.openxmlformats.org/markup-compatibility/2006")" 

   xmlns:d="[http://schemas.microsoft.com/expression/blend/2008](http://schemas.microsoft.com/expression/blend/2008 "http://schemas.microsoft.com/expression/blend/2008")" 

   xmlns:local="clr-namespace:ActiveElementsOverlay.Background"

   mc:Ignorable="d" 

   d:DesignHeight="816" d:DesignWidth="1152">
<Button Content ="ClickMe" Name="Btn" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

Code behind

public UserControl1()

{

  InitializeComponent();

}

public void SetContext(ImageViewerAddOn imageViewerAddOn)

{

  \_imageViewerAddOn = imageViewerAddOn;

  \_tag = \_imageViewerAddOn.ActiveElementsOverlayAdd(new List<FrameworkElement> 

                            { this }, 

                            new ActiveElementsOverlayRenderParameters() 

                            { 

                              FollowDigitalZoom = false, 

                              ShowAlways = true, 

                              ZOrder = 2 

                            });

}

Any hint of what I am doing wrong? Smart client 2020R3

Thanks

I am sorry for the delayed response. We have asked Milestone Development and they explain :

Regarding the stretch issue, on buttons we apply a WPF style which set height to be 22, this overrules the stretch property. To solve this there are two ways:

  • Set Style=“{x:Null}” which removes any style on the button
  • Set Height to be double.NAN. I could only do this in code behind, but this allows the default style to work, without overrueling the stretch setting.

Just a quick update to Rie’s answer. In order to keep the theming from the Smart Client styles, we sugest that you set the Height to double.NAN. This will be the best solution

Thank you very much to both of you for the valuable insight!