This is how I got it to work:
User Control WPF
<UserControl x:Class="App.ProcessView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>
User Control C#
namespace App {
/// <summary>
/// Interaction logic for ProcessView.xaml
/// </summary>
public partial class ProcessView : UserControl // My custom User Control
{
public ProcessView()
{
InitializeComponent();
}
} }
MainWindow WPF
<Window x:Name="RootWindow" x:Class="App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:App"
Title="Some Title" Height="350" Width="525" Closing="Window_Closing_1" Icon="bouncer.ico">
<Window.Resources>
<app:DateConverter x:Key="dateConverter"/>
</Window.Resources>
<Grid>
<ListView x:Name="listView" >
<ListView.ItemTemplate>
<DataTemplate>
<app:ProcessView />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Window>