| Author: K Hari Prasad 03 Nov 2009 | Member Level: Gold | Rating:  Points: 2 |
First Create the UserControl:
<UserControl x:Class="WpfApplication1.ButtonUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid> <Button Name="btnOk" Height="20" Width="100" Content="OK"></Button> </Grid> </UserControl>
Second : reference the above user control like below and use it.
<Window x:Class="WpfApplication1.Window5" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" Title="Window5" Height="300" Width="300"> <Grid> <local:ButtonUserControl></local:ButtonUserControl> </Grid> </Window>
|