i hope your main window contain DataGrid .
create a datatemplate
<datatemplate x:key="DataTemplateBaseChargeSetting" xmlns:x="#unknown">
<border borderthickness="1">
BorderBrush="Transparent"
CornerRadius="2"
HorizontalAlignment="Stretch"
Margin="2">
<border borderbrush="Black">
BorderThickness="1"
CornerRadius="3"
Margin="2">
<grid>
<grid.columndefinitions>
<columndefinition width="auto" />
<columndefinition width="auto" />
<columndefinition width="*" />
</grid.columndefinitions>
<uielements:gibutton name="btnEdit" xmlns:uielements="#unknown">
Grid.Column="0"
Margin="2"
Height="18"
Width="18"
Command="LocalCommands:Commands.EditBaseRate"
CommandParameter="{Binding}"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Style="{DynamicResource IconButtonStyle}">
<image source="{DynamicResource Edit}">
VerticalAlignment="Center"
HorizontalAlignment="Center"
Height="18"
Width="18"></image>
</uielements:gibutton>
<uielements:gibutton name="btnDelete" xmlns:uielements="#unknown">
Width="18"
Height="18"
Style="{StaticResource IconButtonStyle}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalAlignment="Center"
Grid.Column="1"
Margin="2"
Command="LocalCommands:Commands.DeleteBaseRate"
CommandParameter="{Binding}">
<image source="{DynamicResource Delete}">
VerticalAlignment="Center"
HorizontalAlignment="Center"
Height="22"
Width="22" />
</image></uielements:gibutton>
<textblock name="tblChargeCategory">
Margin="2" Width="150"
HorizontalAlignment="Stretch"
Text="{Binding Path=CHARGE_CATEGORY}"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding Text}"
Grid.Column="2" />
</textblock></grid>
</border>
</border>
</datatemplate>
behind the popup window u should create a clr property named as SelectedItem .
private DataRowView _selectedItem;
public DataRowView SelectedItem
{
get
{
return _selectedItem;
}
set
{
_selectedItem = value;
OnPropertyChanged("SelectedItem");
}
}
on edit button click event
call pop window
and create object of pop window and call their property and assign the selected row to that property