Set Popup Window Height from View

Topics: Prism v2 - WPF 3.5
Nov 4, 2009 at 7:00 PM

I'm using the popup window from the RI.  As an example, I'm setting the Window's title using this in the WindowRegionStyle:

<Setter Property="Title" Value="{Binding Path=Content.Title, RelativeSource={RelativeSource Self}}" />

I tried setting the height as such:

<Setter Property="Height" Value="{Binding ElementName=ViewUserControl, Path=Height}" />

and setting:


On the UserControl element of my view.  This did not work with the following error:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=ViewUserControl'. BindingExpression:Path=Height; DataItem=null; target element is 'Window' (Name=''); target property is 'Height' (type 'Double')
What binding path do I use so I can set the Height on the UserControl and have it update the Height in the Window?





Nov 4, 2009 at 7:34 PM

I solved it be replacing Height and Width with:

<Setter Property="SizeToContent" Value="WidthAndHeight"/>