# XAML Sample Code for a Page Plugin

The LED is realized with a Rectangle whose Fill color is changed from the default Black to Spring Green when the led is turned on.

The XAML code:

    <MyBase:Element x:Class="MyLEDWpfControlLibrary.MyLED"
              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"
              xmlns:MyBase="clr-namespace:Cognex.Designer.HMI.Controls;assembly=Cognex.Designer.HMI"
              Height="41" Width="77"
              >
    <Rectangle Name="MyLEDBody" Fill="Black" HorizontalAlignment="Left" Margin="20,14,0,0" Stroke="Black"
               Width="38" Height="16" VerticalAlignment="Top" />

    </MyBase:Element>

The resulting LED in the WPF designer (with its default black turned off color):

XAML code explained:

- A WPF control to be used as a Cognex Designer plugin must always inherit from the Cognex.Designer.HMI.Controls.Element class.
  This class is present in Cognex.Designer.HMI.dll, thus, the
  xmlns:MyBase="clr-namespace:Cognex.Designer.HMI.Controls;assembly=Cognex.Designer.HMI" namespace declaration is used combined with the
  <MyBase:Element ...>...</MyBase:Element> root element declaration.
- The properties of the Rectangle that defines the body of the LED define the default appearance of the LED, including its default width and height.