When I create a new Window, using the Add Item... dialogue, the Window I create, e.g. NewWindow
, does not inherit from Window. It only has the same interface as type Object
. An example:
I have the popup window code below. The code only sees the IHavePassword
members, and not the rest of the members of `LoginPopup', like its controls.
Public Class LoginPopup
Implements IHavePassword
Public ReadOnly Property Password As SecureString Implements IHavePassword.Password
Get
'Return Me.PasswordBox.????
End Get
End Property
Public Event PasswordChanged As RoutedEventHandler Implements IHavePassword.PasswordChanged
Public Sub PassWordChangedHandler(sender As Object, e As EventArgs)
PasswordChangedEvent(sender, e)
End Sub
Public Sub Close() Implements IHavePassword.Close
Throw New NotImplementedException
End Sub
End Class
OH, here is the necessary XAML as well:
<Window x:Class="ApptEase.Client.Prism.Views.LoginPopup"
....
<StackPanel Orientation="Vertical" Margin="0">
<DockPanel LastChildFill="True">
<TextBlock Text="{Binding Path=UsernameLabel}" DockPanel.Dock="Left" TextAlignment="Right" Margin="5,9,5,5" MinWidth="70" />
<TextBox Text="{Binding Path=Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" Width="Auto" Margin="5" />
</DockPanel>
<DockPanel LastChildFill="True">
<TextBlock Text="{Binding Path=PasswordLabel}" DockPanel.Dock="Left" TextAlignment="Right" Margin="5" MinWidth="70" />
<PasswordBox x:Name="PasswordBox" PasswordChanged="PassWordChangedHandler" Width="Auto" Margin="5" />
</DockPanel>
<DockPanel LastChildFill="True" Height="59">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Log in" Command="{Binding Path=LoginCommand}" CommandParameter="{Binding ElementName=This}" Margin="5" Padding="15,10,15,10" />
<Button Content="Cancel" Command="{Binding Path=CancelCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Margin="5" Padding="15,10,15,10"/>
</StackPanel>
</DockPanel>
</StackPanel>
The IntelliSense on the property Me
lists the members of IHavePassword
, e.g:
I would expect to see the controls and base Window
members here, not those of the interface. How do I go about fixing this?