Hello!
This is a window I've called "LicenseHolderView", it contains a DataGrid, called "dgLicenseHolder".
It gets populated nicely using a BindableCollection (from the Stylet framework -- it's like an ObservableCollection).

I am able to add rows (from a separate window), and delete rows (from the same window).
What I am not able to do is to open a selected row in a separate window, having the column data populate their respective TextBoxes.
I want to do this by clicking the "Se profil"-button, which opens the ProfileView-window.
It looks like this:

I have a ViewModel for each view, and in my ProfileViewModel I have the following code, to try and hold the SelectedItem:
private object _selectedItem;
public object SelectedItem {
get { return _selectedItem; }
set {
_selectedItem = value;
SetAndNotify(ref this._selectedItem, value);
}
}
SetAndNotify is a Stylet function, and it works like this:
In LicenseHolderView, my DataGrid is set up like so:
<DataGrid
x:Name="dgLicenseHolder"
Canvas.Left="31"
Canvas.Top="158"
Width="505"
Height="557"
AutoGenerateColumns="False"
BorderBrush="#48bb88"
CanUserAddRows="False"
CanUserDeleteRows="False"
FontSize="20"
IsReadOnly="True"
Loaded="{s:Action FillDataGridLicenseHolders}"
ItemsSource="{Binding Path=LicenseHolders}"
SelectedItem="{Binding SelectedItem}"
SelectionMode="Single" SelectionUnit="FullRow"
SelectionChanged="dgLicenseHolder_SelectionChanged" >
And my columns like so:
<DataGridTextColumn
Width="310"
Header="Foretaksnavn"
HeaderStyle="{StaticResource CenterGridHeaderStyle}"
IsReadOnly="True"
Visibility="Visible"
Binding="{Binding Path=Foretaksnavn,
UpdateSourceTrigger=PropertyChanged}"/>
In my ProfileView, my TextBoxes are bound like so:
<TextBox
Name="txtForetaksnavn"
Canvas.Left="150"
Canvas.Top="166"
Width="162"
Height="24"
VerticalContentAlignment="Center"
FontSize="12"
IsReadOnly="True"
Text="{Binding SelectedItem, Mode=TwoWay}" />
But when I run my application, the TextBoxes are not populated.
Stylet is a ViewModel-first framework, and I am running with no code-behind.
(It is a lot like Caliburn.Micro, if people are more familiar with that).
Very appreciative for any help that will correct my thinking, because I am stuck! :-)
