<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infragistics.com/community/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>WPF</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 10 Non-Production</generator><item><title>WPF</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki</link><pubDate>Fri, 01 Dec 2017 07:35:11 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:c8e23e12-b58d-4cee-ab8e-6d54fb86fa05</guid><dc:creator>Anonymous</dc:creator><description>Current Revision posted to WPF by Anonymous on 12/1/2017 7:35:11 AM&lt;br /&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Spell Checking in the XamDataGrid</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/44/spell-checking-in-the-xamdatagrid</link><pubDate>Wed, 10 Jun 2009 12:30:14 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:03c769c0-b89b-4999-b6b7-b7bd8cc8c732</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 6/10/2009 12:30:14 PM&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;
&lt;p&gt;Utilizing the Framework&amp;rsquo;s built-in capabilities for spell checking makes adding spell-checking support to the XamDataGrid a breeze.&amp;nbsp; &lt;/p&gt;
&lt;h3&gt;The Code&lt;/h3&gt;
&lt;p&gt;Basically, you just need to turn on spell checking for the editor that is being used in the XamDataGrid.&amp;nbsp; The default editor is the XamTextEditor.&amp;nbsp; If you set this style at the Window level, every XamTextEditor will have spell checking enabled.&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:18f4ac6e-9c31-44a6-98d3-4bde4eb1e618" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;Style TargetType=&amp;quot;{x:Type igEditors:XamTextEditor}&amp;quot;&amp;gt;
    &amp;lt;Setter Property=&amp;quot;SpellCheck.IsEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;
&amp;lt;/Style&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/articles_5F00_staging/image_5F00_5878DEE7.png"&gt;&lt;img height="316" width="463" src="http://download.infragistics.com/users/AndrewF/spellcheck.png" alt="image" border="0" title="image" style="display:inline;border-width:0px;border:0;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid&lt;/div&gt;
</description></item><item><title>XamDataGrid :: Copying to Excel via the Clipboard</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/38/xamdatagrid-copying-to-excel-via-the-clipboard</link><pubDate>Fri, 10 Apr 2009 11:18:21 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:7512e0d8-e10c-4474-b2d9-2cc064361e07</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 4/10/2009 11:18:21 AM&lt;br /&gt;
&lt;p&gt;One of the common tasks that many end-users have is to copy data from an application to Excel or Word or any other Windows Apps.&amp;nbsp; The way to do this is to copy items to the Clipboard and Microsoft provides a really nice class that makes this simple to do.&amp;nbsp; The point of this article is to offer a brief glimpse on how to copy cell values from the XamDataGrid to the clipboard.&amp;nbsp; It will focus on three different selection strategies range select (only for contiguous ranges), record selection (rows), or field selections (columns).&lt;/p&gt;
&lt;h4&gt;Handling Selection in the XamDataGrid&lt;/h4&gt;
&lt;p&gt;To enable selection in the above three scenarios you may also want to make some modifications to the XamDataGrid that allow for the user to easily select a range of cells and allow them to select all of the cells in a field by clicking on a field header.&amp;nbsp; The code to do this looks like this:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:a2e819b4-d989-4d17-afce-7fbcb40c64fa" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataGrid.FieldSettings&amp;gt;
	&amp;lt;igDP:FieldSettings LabelClickAction=&amp;quot;SelectField&amp;quot; CellClickAction=&amp;quot;SelectCell&amp;quot; /&amp;gt;
&amp;lt;/igDP:XamDataGrid.FieldSettings&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;Managing Ctrl+C&lt;/h4&gt;
&lt;p&gt;To ensure that the XamDataGrid responds to Ctrl+C you need to add input bindings to the XamDataGrid that point to that particular keystroke.&amp;nbsp; To do this you need to find a way to point the CTRL+C keystroke to an event or command that fires off the XamDataGrid.&amp;nbsp; The code to handle this gesture looks like this:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5b6b8be5-3e54-481b-8700-58ae8573ce76" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataGrid.InputBindings&amp;gt;
    &amp;lt;KeyBinding Command=&amp;quot;{x:Static myApp:Window1.CopyCommand}&amp;quot; Gesture=&amp;quot;CTRL+C&amp;quot; /&amp;gt;
&amp;lt;/igDP:XamDataGrid.InputBindings&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Setting up the Copy Command&lt;/h4&gt;
&lt;p&gt;In the procedural code you now need to define this copy command.&amp;nbsp; To do so, you need to declare it:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:02dc092f-d56a-49ed-b4e6-09fb10a5b4f5" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;public static RoutedCommand CopyCommand = new RoutedCommand();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hooked up this command in the constructor for our Window:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f33363c6-7989-4c37-8097-167acaa0f6ca" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;public Window1()
{
    CommandBinding copyCommandBinding = 
		new CommandBinding(CopyCommand, ExecutedCopyCommand);
    this.CommandBindings.Add(copyCommandBinding);
    InitializeComponent();
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After you have the command bindings set up you can handle the ExecutedCopyCommand and this is what will actually be called by the CTRL+C method.&amp;nbsp; In this method, I look at the XamDataGrid that calls the command and check to see which of the SelectedItemsCollections hold items and call a method to handle them based on the actual selected collection:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:21c18d0a-24e9-4863-aa5b-192c8ede5e00" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private void ExecutedCopyCommand(object sender, ExecutedRoutedEventArgs e)
{
    Infragistics.Windows.DataPresenter.XamDataGrid myGrid = 
		e.Source as Infragistics.Windows.DataPresenter.XamDataGrid;

    if (myGrid.SelectedItems.Cells.Count &amp;gt; 0)
        CopySelectedCells(myGrid);
    else if (myGrid.SelectedItems.Records.Count &amp;gt; 0)
        CopySelectedRecords(myGrid);
    else if (myGrid.SelectedItems.Fields.Count &amp;gt; 0)
        CopySelectedFields(myGrid);

}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Copy a Range of Cells&lt;/h4&gt;
&lt;p&gt;This method will enable the end-user to select a range of cells and format them appropriately to copy their text to clipboard.&amp;nbsp; This formatting also enables the copying to be direct to rows/columns in Excel.&amp;nbsp; One caveat is that it only allows for a contiguous range of cells (as this is the only capabilities enabled by Excel):&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:9ece0efb-0382-4055-83ef-15cc960f8ed1" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private static void CopySelectedCells(Infragistics.Windows.DataPresenter.XamDataGrid myGrid)
{
    string myInternalClipboard = null;
    int currentRecordLevel = 0;
    Infragistics.Windows.DataPresenter.SelectedCellCollection mySelectedCells = myGrid.SelectedItems.Cells;

    foreach (Cell myCell in mySelectedCells)
    {
        if (myInternalClipboard == null)
        {
            currentRecordLevel = myCell.Record.DataItemIndex;
            myInternalClipboard = myCell.Value.ToString();
        }
        else if (myCell.Record.DataItemIndex == currentRecordLevel)
            myInternalClipboard = myInternalClipboard + &amp;quot;\t&amp;quot; + myCell.Value.ToString();
        else
        {
            currentRecordLevel = myCell.Record.DataItemIndex;
            myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot; + myCell.Value.ToString();
        }
    }
    myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot;;
    Clipboard.Clear();
    Clipboard.SetText(myInternalClipboard);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Copy a Range of Records&lt;/h4&gt;
&lt;p&gt;This method allows the end-user to select a record(row) or a range of rows and copy them to the clipboard and then past them to a particular app while still distinguishing different columns:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c161e3df-986a-4d0c-b6ac-5ab782bc1290" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private static void CopySelectedRecords(Infragistics.Windows.DataPresenter.XamDataGrid myGrid)
{
    string myInternalClipboard = null;
    bool IsNewRecord = true;
    Infragistics.Windows.DataPresenter.SelectedRecordCollection mySelectedRecords = 
		myGrid.SelectedItems.Records;

    foreach (DataRecord myRecord in mySelectedRecords)
    {
        foreach(Cell myCell in myRecord.Cells)
        {
            if (myInternalClipboard == null || IsNewRecord == true)
            {
                myInternalClipboard = myInternalClipboard + myCell.Value.ToString();
                IsNewRecord = false;
            }
            else
                myInternalClipboard = myInternalClipboard + &amp;quot;\t&amp;quot; + myCell.Value.ToString();
        }
        IsNewRecord = true;
        myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot;;
    }
    Clipboard.Clear();
    Clipboard.SetText(myInternalClipboard);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Copy a Range of Fields&lt;/h4&gt;
&lt;p&gt;This allows the end-user to select a column or a range of columns and copy those values to the clipboard.&amp;nbsp; It was interesting to implement as when you select a field, you&amp;rsquo;re not actually selecting the cells in that field, but the entire field.&amp;nbsp; So, you actually have to loop through all the records and build your clipboard string based on the parameters of the selected fields:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:4909d4b6-1dce-44ab-8f5c-7fd64a7da58c" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private static void CopySelectedFields(Infragistics.Windows.DataPresenter.XamDataGrid myGrid)
{
    string myInternalClipboard = null;
    bool IsNewRecord = true;
    Infragistics.Windows.DataPresenter.SelectedFieldCollection mySelectedFields = 
		myGrid.SelectedItems.Fields;

    foreach (DataRecord myRecord in myGrid.Records)
    {
        foreach (Field myField in mySelectedFields)
        {
            if (myInternalClipboard == null || IsNewRecord == true)
            {
                myInternalClipboard = myInternalClipboard + myRecord.Cells[myField].Value.ToString();
                IsNewRecord = false;
            }
            else
            {
                myInternalClipboard = myInternalClipboard + &amp;quot;\t&amp;quot; + myRecord.Cells[myField].Value.ToString();
            }
        }
        IsNewRecord = true;
        myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot;;
    }
    Clipboard.Clear();
    Clipboard.SetText(myInternalClipboard);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;That&amp;rsquo;s it.&amp;nbsp; After adding this simple code to your application, you can now allow your end-users to copy from the XamDataGrid to an Excel file or to any Windows Application.&amp;nbsp; You can download the code for this example &lt;a href="http://download.infragistics.com/community/wpf/articles/XamDataGrid_ClipboardSample.zip"&gt;here&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;img height="549" width="630" src="http://download.infragistics.com/community/wpf/articles/copypaste.png" alt="" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Excel&lt;/div&gt;
</description></item><item><title>XamDataGrid :: Copying to Excel via the Clipboard</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/38/xamdatagrid-copying-to-excel-via-the-clipboard/revision/1</link><pubDate>Fri, 10 Apr 2009 11:17:05 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:7512e0d8-e10c-4474-b2d9-2cc064361e07</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Revision 1 posted to WPF by [Infragistics] Andrew Flick on 4/10/2009 11:17:05 AM&lt;br /&gt;
&lt;p&gt;One of the common tasks that many end-users have is to copy data from an application to Excel or Word or any other Windows Apps.&amp;nbsp; The way to do this is to copy items to the Clipboard and Microsoft provides a really nice class that makes this simple to do.&amp;nbsp; The point of this article is to offer a brief glimpse on how to copy cell values from the XamDataGrid to the clipboard.&amp;nbsp; It will focus on three different selection strategies range select (only for contiguous ranges), record selection (rows), or field selections (columns).&lt;/p&gt;
&lt;h4&gt;Handling Selection in the XamDataGrid&lt;/h4&gt;
&lt;p&gt;To enable selection in the above three scenarios you may also want to make some modifications to the XamDataGrid that allow for the user to easily select a range of cells and allow them to select all of the cells in a field by clicking on a field header.&amp;nbsp; The code to do this looks like this:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:a2e819b4-d989-4d17-afce-7fbcb40c64fa" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataGrid.FieldSettings&amp;gt;
	&amp;lt;igDP:FieldSettings LabelClickAction=&amp;quot;SelectField&amp;quot; CellClickAction=&amp;quot;SelectCell&amp;quot; /&amp;gt;
&amp;lt;/igDP:XamDataGrid.FieldSettings&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;Managing Ctrl+C&lt;/h4&gt;
&lt;p&gt;To ensure that the XamDataGrid responds to Ctrl+C you need to add input bindings to the XamDataGrid that point to that particular keystroke.&amp;nbsp; To do this you need to find a way to point the CTRL+C keystroke to an event or command that fires off the XamDataGrid.&amp;nbsp; The code to handle this gesture looks like this:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5b6b8be5-3e54-481b-8700-58ae8573ce76" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataGrid.InputBindings&amp;gt;
    &amp;lt;KeyBinding Command=&amp;quot;{x:Static myApp:Window1.CopyCommand}&amp;quot; Gesture=&amp;quot;CTRL+C&amp;quot; /&amp;gt;
&amp;lt;/igDP:XamDataGrid.InputBindings&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Setting up the Copy Command&lt;/h4&gt;
&lt;p&gt;In the procedural code you now need to define this copy command.&amp;nbsp; To do so, you need to declare it:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:02dc092f-d56a-49ed-b4e6-09fb10a5b4f5" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;public static RoutedCommand CopyCommand = new RoutedCommand();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hooked up this command in the constructor for our Window:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f33363c6-7989-4c37-8097-167acaa0f6ca" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;public Window1()
{
    CommandBinding copyCommandBinding = 
		new CommandBinding(CopyCommand, ExecutedCopyCommand);
    this.CommandBindings.Add(copyCommandBinding);
    InitializeComponent();
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After you have the command bindings set up you can handle the ExecutedCopyCommand and this is what will actually be called by the CTRL+C method.&amp;nbsp; In this method, I look at the XamDataGrid that calls the command and check to see which of the SelectedItemsCollections hold items and call a method to handle them based on the actual selected collection:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:21c18d0a-24e9-4863-aa5b-192c8ede5e00" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="delphi"&gt;private void ExecutedCopyCommand(object sender, ExecutedRoutedEventArgs e)
{
    Infragistics.Windows.DataPresenter.XamDataGrid myGrid = 
		e.Source as Infragistics.Windows.DataPresenter.XamDataGrid;

    if (myGrid.SelectedItems.Cells.Count &amp;gt; 0)
        CopySelectedCells(myGrid);
    else if (myGrid.SelectedItems.Records.Count &amp;gt; 0)
        CopySelectedRecords(myGrid);
    else if (myGrid.SelectedItems.Fields.Count &amp;gt; 0)
        CopySelectedFields(myGrid);

}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Copy a Range of Cells&lt;/h4&gt;
&lt;p&gt;This method will enable the end-user to select a range of cells and format them appropriately to copy their text to clipboard.&amp;nbsp; This formatting also enables the copying to be direct to rows/columns in Excel.&amp;nbsp; One caveat is that it only allows for a contiguous range of cells (as this is the only capabilities enabled by Excel):&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:9ece0efb-0382-4055-83ef-15cc960f8ed1" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private static void CopySelectedCells(Infragistics.Windows.DataPresenter.XamDataGrid myGrid)
{
    string myInternalClipboard = null;
    int currentRecordLevel = 0;
    Infragistics.Windows.DataPresenter.SelectedCellCollection mySelectedCells = myGrid.SelectedItems.Cells;

    foreach (Cell myCell in mySelectedCells)
    {
        if (myInternalClipboard == null)
        {
            currentRecordLevel = myCell.Record.DataItemIndex;
            myInternalClipboard = myCell.Value.ToString();
        }
        else if (myCell.Record.DataItemIndex == currentRecordLevel)
            myInternalClipboard = myInternalClipboard + &amp;quot;\t&amp;quot; + myCell.Value.ToString();
        else
        {
            currentRecordLevel = myCell.Record.DataItemIndex;
            myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot; + myCell.Value.ToString();
        }
    }
    myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot;;
    Clipboard.Clear();
    Clipboard.SetText(myInternalClipboard);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Copy a Range of Records&lt;/h4&gt;
&lt;p&gt;This method allows the end-user to select a record(row) or a range of rows and copy them to the clipboard and then past them to a particular app while still distinguishing different columns:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c161e3df-986a-4d0c-b6ac-5ab782bc1290" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private static void CopySelectedRecords(Infragistics.Windows.DataPresenter.XamDataGrid myGrid)
{
    string myInternalClipboard = null;
    bool IsNewRecord = true;
    Infragistics.Windows.DataPresenter.SelectedRecordCollection mySelectedRecords = 
		myGrid.SelectedItems.Records;

    foreach (DataRecord myRecord in mySelectedRecords)
    {
        foreach(Cell myCell in myRecord.Cells)
        {
            if (myInternalClipboard == null || IsNewRecord == true)
            {
                myInternalClipboard = myInternalClipboard + myCell.Value.ToString();
                IsNewRecord = false;
            }
            else
                myInternalClipboard = myInternalClipboard + &amp;quot;\t&amp;quot; + myCell.Value.ToString();
        }
        IsNewRecord = true;
        myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot;;
    }
    Clipboard.Clear();
    Clipboard.SetText(myInternalClipboard);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Copy a Range of Fields&lt;/h4&gt;
&lt;p&gt;This allows the end-user to select a column or a range of columns and copy those values to the clipboard.&amp;nbsp; It was interesting to implement as when you select a field, you&amp;rsquo;re not actually selecting the cells in that field, but the entire field.&amp;nbsp; So, you actually have to loop through all the records and build your clipboard string based on the parameters of the selected fields:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:4909d4b6-1dce-44ab-8f5c-7fd64a7da58c" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private static void CopySelectedFields(Infragistics.Windows.DataPresenter.XamDataGrid myGrid)
{
    string myInternalClipboard = null;
    bool IsNewRecord = true;
    Infragistics.Windows.DataPresenter.SelectedFieldCollection mySelectedFields = 
		myGrid.SelectedItems.Fields;

    foreach (DataRecord myRecord in myGrid.Records)
    {
        foreach (Field myField in mySelectedFields)
        {
            if (myInternalClipboard == null || IsNewRecord == true)
            {
                myInternalClipboard = myInternalClipboard + myRecord.Cells[myField].Value.ToString();
                IsNewRecord = false;
            }
            else
            {
                myInternalClipboard = myInternalClipboard + &amp;quot;\t&amp;quot; + myRecord.Cells[myField].Value.ToString();
            }
        }
        IsNewRecord = true;
        myInternalClipboard = myInternalClipboard + &amp;quot;\r\n&amp;quot;;
    }
    Clipboard.Clear();
    Clipboard.SetText(myInternalClipboard);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;That&amp;rsquo;s it.&amp;nbsp; After adding this simple code to your application, you can now allow your end-users to copy from the XamDataGrid to an Excel file or to any Windows Application.&amp;nbsp; You can download the code for this example &lt;a href="http://download.infragistics.com/community/wpf/articles/XamDataGrid_ClipboardSample.zip"&gt;here&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;img height="549" width="630" src="http://download.infragistics.com/community/wpf/articles/copypaste.png" alt="" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Excel&lt;/div&gt;
</description></item><item><title>Validation in the XamDataGrid</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/37/validation-in-the-xamdatagrid</link><pubDate>Mon, 06 Apr 2009 16:41:12 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:bcccd175-d3c5-4611-b79e-b1499c3a2f6c</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 4/6/2009 4:41:12 PM&lt;br /&gt;
&lt;p&gt;Validation in the XamDataGrid is currently handled through the ValueConstraint class off of the Editors.&amp;nbsp; Using this class you can do things like set a trigger to change the border of a cell to red when an invalid value it entered.&amp;nbsp; This article shows off how to use the ValueConstraints class.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The first thing to understand is that there are multiple types of constraints and they include the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FixedValue Condition&lt;/strong&gt; &amp;ndash; Does the value equal this? &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enumeration Condition&lt;/strong&gt; &amp;ndash; An Object implementing IEnumerable which contains a list of values. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MaxExclusive Condition&lt;/strong&gt; &amp;ndash; The value must be less than this. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MaxInclusive Condition&lt;/strong&gt; &amp;ndash; The max value that the constrained value can be. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MinExclusive Condition&lt;/strong&gt; &amp;ndash; The value must be greater than this. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MinInclusive Condition&lt;/strong&gt; &amp;ndash; The min value that the constrained value can be. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Min/MaxLength Condition&lt;/strong&gt; &amp;ndash; The length of type string must be greater/less than this. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nullable Condition&lt;/strong&gt; &amp;ndash; Whether the constrained value can be null. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RegExPattern Condition&lt;/strong&gt; &amp;ndash; A regular expression for the value. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Using BindToSampleData property on the XamDataGrid to practice validation.&lt;/h3&gt;
&lt;h4&gt;Enumeration of Fixed Values:&lt;/h4&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5b68253a-78ae-468a-ac30-d9e1c1c2dd6c" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:Field Name=&amp;quot;department&amp;quot; Label=&amp;quot;Department&amp;quot;&amp;gt;
    &amp;lt;igDP:Field.Settings&amp;gt;
        &amp;lt;igDP:FieldSettings EditorType=&amp;quot;{x:Type igEdit:XamTextEditor}&amp;quot;&amp;gt;
            &amp;lt;igDP:FieldSettings.EditorStyle&amp;gt;
                &amp;lt;Style TargetType=&amp;quot;{x:Type igEdit:ValueEditor}&amp;quot;&amp;gt;
                    &amp;lt;Style.Resources&amp;gt;
                        &amp;lt;x:Array Type=&amp;quot;sys:String&amp;quot; x:Key=&amp;quot;FixedValue&amp;quot;&amp;gt;
                            &amp;lt;sys:String&amp;gt;Admin&amp;lt;/sys:String&amp;gt;
                            &amp;lt;sys:String&amp;gt;Sales&amp;lt;/sys:String&amp;gt;
                            &amp;lt;sys:String&amp;gt;Human Resources&amp;lt;/sys:String&amp;gt;
                        &amp;lt;/x:Array&amp;gt;
                    &amp;lt;/Style.Resources&amp;gt;
                    &amp;lt;Style.Setters&amp;gt;
                        &amp;lt;Setter Property=&amp;quot;ValueConstraint&amp;quot;&amp;gt;
                            &amp;lt;Setter.Value&amp;gt;
                                &amp;lt;igEdit:ValueConstraint Enumeration=&amp;quot;{StaticResource FixedValue}&amp;quot; /&amp;gt;
                            &amp;lt;/Setter.Value&amp;gt;
                        &amp;lt;/Setter&amp;gt;
                        &amp;lt;Setter Property=&amp;quot;InvalidValueBehavior&amp;quot; Value=&amp;quot;RetainValue&amp;quot; /&amp;gt;
                    &amp;lt;/Style.Setters&amp;gt;
                    &amp;lt;Style.Triggers&amp;gt;
                        &amp;lt;Trigger Property=&amp;quot;IsValueValid&amp;quot; Value=&amp;quot;false&amp;quot;&amp;gt;
                            &amp;lt;Trigger.Setters&amp;gt;
                                &amp;lt;Setter Property=&amp;quot;BorderBrush&amp;quot; Value=&amp;quot;Red&amp;quot; /&amp;gt;
                            &amp;lt;/Trigger.Setters&amp;gt;
                        &amp;lt;/Trigger&amp;gt;
                    &amp;lt;/Style.Triggers&amp;gt;
                &amp;lt;/Style&amp;gt;
            &amp;lt;/igDP:FieldSettings.EditorStyle&amp;gt;
        &amp;lt;/igDP:FieldSettings&amp;gt;
    &amp;lt;/igDP:Field.Settings&amp;gt;
&amp;lt;/igDP:Field&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Max/Min Inclusive:&lt;/h4&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:75ac1fef-bf62-438b-ab00-35577dd8318a" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:Field Name=&amp;quot;salary&amp;quot; Label=&amp;quot;Salary&amp;quot;&amp;gt;
    &amp;lt;igDP:Field.Settings&amp;gt;
        &amp;lt;igDP:FieldSettings EditorType=&amp;quot;{x:Type igEdit:XamCurrencyEditor}&amp;quot; EditAsType=&amp;quot;{x:Type sys:Double}&amp;quot;&amp;gt;
            &amp;lt;igDP:FieldSettings.EditorStyle&amp;gt;
                &amp;lt;Style TargetType=&amp;quot;{x:Type igEdit:ValueEditor}&amp;quot;&amp;gt;
                    &amp;lt;Style.Setters&amp;gt;
                        &amp;lt;Setter Property=&amp;quot;ValueConstraint&amp;quot;&amp;gt;
                            &amp;lt;Setter.Value&amp;gt;
                                &amp;lt;igEdit:ValueConstraint MinInclusive=&amp;quot;0&amp;quot; MaxInclusive=&amp;quot;100000&amp;quot; /&amp;gt;
                            &amp;lt;/Setter.Value&amp;gt;
                        &amp;lt;/Setter&amp;gt;
                        &amp;lt;Setter Property=&amp;quot;InvalidValueBehavior&amp;quot; Value=&amp;quot;RetainValue&amp;quot; /&amp;gt;
                    &amp;lt;/Style.Setters&amp;gt;
                    &amp;lt;Style.Triggers&amp;gt;
                        &amp;lt;Trigger Property=&amp;quot;IsValueValid&amp;quot; Value=&amp;quot;false&amp;quot;&amp;gt;
                            &amp;lt;Trigger.Setters&amp;gt;
                                &amp;lt;Setter Property=&amp;quot;BorderBrush&amp;quot; Value=&amp;quot;Red&amp;quot; /&amp;gt;
                            &amp;lt;/Trigger.Setters&amp;gt;
                        &amp;lt;/Trigger&amp;gt;
                    &amp;lt;/Style.Triggers&amp;gt;
                &amp;lt;/Style&amp;gt;
            &amp;lt;/igDP:FieldSettings.EditorStyle&amp;gt;
        &amp;lt;/igDP:FieldSettings&amp;gt;
    &amp;lt;/igDP:Field.Settings&amp;gt;
&amp;lt;/igDP:Field&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Reg-Ex for an E-Mail:&lt;/h4&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f7bd1917-3eab-40bd-9e24-e6a76926c4ee" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:Field Name=&amp;quot;email&amp;quot; Label=&amp;quot;E-Mail&amp;quot;&amp;gt;
    &amp;lt;igDP:Field.Settings&amp;gt;
        &amp;lt;igDP:FieldSettings EditorType=&amp;quot;{x:Type igEdit:XamTextEditor}&amp;quot;&amp;gt;
            &amp;lt;igDP:FieldSettings.EditorStyle&amp;gt;
                &amp;lt;Style TargetType=&amp;quot;{x:Type igEdit:ValueEditor}&amp;quot;&amp;gt;
                    &amp;lt;Style.Setters&amp;gt;
                        &amp;lt;Setter Property=&amp;quot;ValueConstraint&amp;quot;&amp;gt;
                            &amp;lt;Setter.Value&amp;gt;
                                &amp;lt;igEdit:ValueConstraint RegexPattern=&amp;quot;^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([;.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$&amp;quot; /&amp;gt;
                            &amp;lt;/Setter.Value&amp;gt;
                        &amp;lt;/Setter&amp;gt;
                        &amp;lt;Setter Property=&amp;quot;InvalidValueBehavior&amp;quot; Value=&amp;quot;RetainValue&amp;quot; /&amp;gt;
                    &amp;lt;/Style.Setters&amp;gt;
                    &amp;lt;Style.Triggers&amp;gt;
                        &amp;lt;Trigger Property=&amp;quot;IsValueValid&amp;quot; Value=&amp;quot;false&amp;quot;&amp;gt;
                            &amp;lt;Trigger.Setters&amp;gt;
                                &amp;lt;Setter Property=&amp;quot;BorderBrush&amp;quot; Value=&amp;quot;Red&amp;quot; /&amp;gt;
                            &amp;lt;/Trigger.Setters&amp;gt;
                        &amp;lt;/Trigger&amp;gt;
                    &amp;lt;/Style.Triggers&amp;gt;
                &amp;lt;/Style&amp;gt;
            &amp;lt;/igDP:FieldSettings.EditorStyle&amp;gt;
        &amp;lt;/igDP:FieldSettings&amp;gt;
    &amp;lt;/igDP:Field.Settings&amp;gt;
&amp;lt;/igDP:Field&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;EditModeValidationError Event&lt;/h3&gt;
&lt;p&gt;So, your user has failed the validation logic that you&amp;rsquo;ve put in place.&amp;nbsp; When this happens the EditModeValidationError Event fires and allows you to perform some action.&amp;nbsp; For instance, you can configure the error message as follows:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:dc1d8a0a-cec0-4e3a-8486-04f2d887fde0" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;pre name="code" class="c#"&gt;private void xamDataGrid1_EditModeValidationError(object sender, Infragistics.Windows.DataPresenter.Events.EditModeValidationErrorEventArgs e)
{
    switch (e.Cell.Field.Name.ToString())
    {
        case &amp;quot;department&amp;quot;:
            e.ErrorMessage = &amp;quot;That department does not exist!  Please enter a valid department.&amp;quot;
            break;
        case &amp;quot;salary&amp;quot;:
            e.ErrorMessage = &amp;quot;Salary cannot be more than $100,000.00&amp;quot;;
            break;
        case &amp;quot;email&amp;quot;:
            e.ErrorMessage = &amp;quot;Please enter an e-mail address (e.g. __@__.com)&amp;quot;;
            break;
    }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;That wraps up this article on validation in the XamDataGrid.&amp;nbsp; Now keep in mind that this works with all of our editors as well; so you&amp;rsquo;re not&amp;hellip;constrained&amp;hellip;to the XamDataGrid to use these capabilities.&amp;nbsp; You can grab the code for this sample &lt;a href="http://download.infragistics.com/community/wpf/articles/IGValidation_Sample.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/articles_5F00_staging/Validation_5F00_3A9BA9E0.png"&gt;&lt;img height="374" width="640" src="http://download.infragistics.com/community/wpf/articles/validation.png" alt="Validation" border="0" title="Validation" style="display:inline;border:0;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid&lt;/div&gt;
</description></item><item><title>Hosting a WPF Control in a Windows Forms Application</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/20/hosting-a-wpf-control-in-a-windows-forms-application</link><pubDate>Mon, 09 Mar 2009 08:56:16 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:32b78a89-22e7-4d30-b978-d382dc1ba763</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 3/9/2009 8:56:16 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;WPF to Windows Forms Interop is one of the development strategies that will take existing applications and bring them to the future. WPF currently provides the ability to fairly easily create new experiences for visualizing applications. Windows Forms has the tools, the frameworks, and years of development effort invested into its existence. If you have a legacy application in Windows Forms and wish to add new experiences to it or better ways to visualize information; then Interop is the way to go.&lt;/p&gt;
&lt;p&gt;Infragistics has released its first WPF controls and included in this suite of controls are new metaphors for visualizing information or for that matter creating navigation items. It makes perfect sense to include these controls inside of existing Windows Forms Applications.&lt;/p&gt;
&lt;h4&gt;Adding References&lt;/h4&gt;
&lt;p&gt;To begin we&amp;#39;ll focus on the first challenge in integration, which is to get the WPF control (in this case the XamDataPresenter) into the Windows Forms Application. First you need to add references to the Microsoft WPF assemblies that handle WPF, the assemblies are as follows: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PresentationFramework &lt;/li&gt;
&lt;li&gt;PresentationCore &lt;/li&gt;
&lt;li&gt;WindowsBase &lt;/li&gt;
&lt;li&gt;WindowsFormsIntegration &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After adding references to the Microsoft assemblies, next add references to the Infragistics assemblies which include: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Infragistics3.Windows.DataPresenter.v7.1 &lt;/li&gt;
&lt;li&gt;Infragistics3.Windows.v7.1 &lt;/li&gt;
&lt;li&gt;Infragistics3.Windows.Editors.v7.1 &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Hosting the xamDataPresenter in an ElementHost for Windows Forms Apps&lt;/h3&gt;
&lt;p&gt;Next, you&amp;#39;ll need to add code to host the WPF control inside the Windows Forms application. In the case of this sample, I&amp;#39;ll perform the core logic inside of the Form_Load event. The main piece of code revolves around the ElementHost object; which is a container that is used to hold an element [e.g. WPF Control]. &lt;/p&gt;
&lt;p&gt;For the purpose of this sample, I&amp;#39;ll also create an instance of the XamDataPresenter and assign its DataSource property. Then, I&amp;#39;ll need to associate the XamDataPresenter as a child of the ElementHost object. The code will look something like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:dd367add-fa77-4137-a2b1-93fe356bc46f" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;&amp;hellip;
using System.Windows.Forms.Integration;
&amp;hellip;

namespace WindowsForms_WPF_InteropDemo
{
	public partial class Main: Form
	{
		private ElementHost XamHost;
		private Infragistics.Windows.DataPresenter.XamDataPresenter XamDP;
		&amp;hellip;

		private void Form1_Load(object sender, EventArgs e)
		{
			XamHost = new ElementHost();
			XamHost.Dock = DockStyle.Fill;
			this.Controls.Add(XamHost);
			XamDP = new Infragistics.Windows.DataPresenter.XamDataPresenter();
			XamDP.DataSource = this.vSalesPersonSalesByFiscalYearsBindingSource;
			XamHost.Child = XamDP;

		}
&amp;hellip;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p class="Figure"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This implementation is fairly easy to achieve, gives us access to the full XamDataPresenter object model and it was only a few lines of code. This will enable developers to fully target the control inside of Visual Studio.&lt;/p&gt;
&lt;h2&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Designing for WPF &amp;ndash; Building for Windows Forms&lt;/h3&gt;
&lt;p&gt;One of the core concepts for WPF development was the separation of Design from Development. This means you might want to open up the XamDataPresenter inside of Blend and style it in order to fully achieve the experience that you wish to deliver. Now, you could do all of the work on a &amp;#39;dummy&amp;#39; control inside of Blend and cut-copy-paste the XAML code into your Windows Forms project, but that isn&amp;#39;t really a good scenario and breaks down the communication between the two tooling environments and if I want to fully utilize the power of WPF styling capabilities then I should look for another approach. &lt;/p&gt;
&lt;p&gt;One way to get around the problem that I&amp;#39;ve mentioned is to create a WPF Control Library that hosts the XamDataPresenter. This will enable me to fully design the control inside of Blend and I will be able to host the ControlLibrary as the control inside of ElementHost within Visual Studio. (Note: Control Libraries can be built in Blend, but unless you add them to a dummy project they cannot be tested/run.) &lt;/p&gt;
&lt;p&gt;The first challenge I will face is that there is no assigned data source; to get around this I can create a simple XML file that mimics my datasource and I can use that as an intermediate step to style my XamDataPresenter or I can set the BindToSampleData property which will fill my XamDataPresenter with a generic set of data and enable me to focus purely on the styling aspects of the control. That being said, I now have all of the abilities as a designer like the ability to visually style the control and add custom presenters. &lt;/p&gt;
&lt;p&gt;After making all of the design changes, I can simply build my project and either a.) add the project to my Windows Forms Solution or b.) add the DLL for my custom control to the references in the Windows Forms Project.&lt;/p&gt;
&lt;h4&gt;Exposing WPF Properties&lt;/h4&gt;
&lt;p&gt;Inside of Visual Studio, I associate the UserControl to the element host by following the same process as previously noted. I will notice that there is no DataSource property, and in fact, none of the familiar properties that I had in my first sample are there. As a matter of fact, I am now seeing all of the properties of the UserControl and not that of the XamDataPresenter. The ideal solution is to have both the ability to design in Blend and code inside of Visual Studio. To achieve this, I&amp;#39;ll have to add some code to my UserControl that exposes the underlying properties of the XamDataPresenter. &lt;/p&gt;
&lt;p&gt;To begin, I&amp;#39;ll start by adding a public property to my UserControl that lets me access the datasource property of the XamDataPresenter. The code might look something like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:2560a87f-ab84-4816-842d-d31174229ea8" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;public System.Collections.IEnumerable DataSource
{
	get { return this.XamDataPresenterInternal.DataSource; }
	set { this.XamDataPresenterInternal.DataSource = value; }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;&lt;br /&gt;Listening to WPF Events&lt;/h4&gt;
&lt;p&gt;Theoretically, I can expose all of the properties I need on the underlying XamDataPresenter by associating them as public properties of the usercontrol. Aside from properties, I may also need to expose some events to my base project. In this sample, I&amp;#39;ll add some events that validate cell values before exiting edit mode on a grid cell. Since, the EditModeEndingEvent will not be available in my Windows Forms Application, I&amp;#39;ll create a public event off of the user control that will handle the event off of the underlying XamDataPresenter and let me act on it inside of my Windows Forms Application. The following code will be placed in my .xaml.cs file:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:73ebd821-88f8-49ac-a5aa-4754de82662e" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;public static RoutedEvent EditModeEndingEvent = EventManager.RegisterRoutedEvent
   (&amp;quot;EditModeEnding&amp;quot;, RoutingStrategy.Bubble, typeof(RoutedEventHandler),
   typeof(XamDataPresenterWrapper));

public event RoutedEventHandler EditModeEnding
{
	add { AddHandler(EditModeEndingEvent, value); }
	remove { RemoveHandler(EditModeEndingEvent, value); }
}

 
void XamDataPresenterInternal_EditModeEnding(object sender,
   Infragistics.Windows.DataPresenter.Events.EditModeEndingEventArgs e)
{
  RaiseEvent(new
     RoutedEventArgs(XamDataPresenterWrapper.EditModeEndingEvent, e));
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, make sure that the .xaml file knows of the event:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:47fa5f77-a9ca-485e-9147-9c60ef4e4194" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataPresenter Name=&amp;quot;XamDataPresenterInternal&amp;quot;
 EditModeEnding=&amp;quot;XamDataPresenterInternal_EditModeEnding&amp;quot;/&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Connecting the WPF Control Library to the Windows Forms Project&lt;/h4&gt;
&lt;p&gt;Now that I&amp;#39;ve handled these changes to my ControlLibrary, I&amp;#39;m going to build it and then jump back into my Windows Forms Project and start hooking everything up. To begin, I&amp;#39;ll start by hooking up the DataSource Property:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:3094401c-bd98-486a-bfd2-723a46e628dd" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;&amp;hellip;
using System.Windows.Forms.Integration;
&amp;hellip;

namespace WindowsForms_WPF_InteropDemo
{
	public partial class Main: Form
	{
		private ElementHost XamHost;
		private Infragistics.XamDataPresenterWrapper XamDataPresenter;
		&amp;hellip;
		private void Main_Load(object sender, EventArgs e)
		{
			&amp;hellip;
			XamHost = new ElementHost();
			XamHost.Dock = DockStyle.Fill;
			this.Controls.Add(XamHost);
			XamDataPresenter = new Infragistics.XamDataPresenterWrapper();
			XamDataPresenter.DataSource =
				this.vSalesPersonSalesByFiscalYearsBindingSource;
			XamHost.Child = XamDataPresenter;
		}

&amp;hellip;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;After completing this work item, I can hook up the event and perform any logic in that event that I need to handle. For the purpose of this sample, I&amp;#39;ll add the event handler to the (Main_Load) Form_Load event and then I&amp;#39;ll add the code to perform whatever logic is needed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:834a7fdf-b192-4c58-8784-fe9e924ebc91" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;&amp;hellip;
using Infragistics.Windows.DataPresenter.Events;
&amp;hellip;

XamDataPresenter.EditModeEnding += 
  new System.Windows.RoutedEventHandler(XamDataPresenter_EditModeEnding);

&amp;hellip;

void XamDataPresenter_EditModeEnding(object sender, System.Windows.RoutedEventArgs e)
{
	// Arguments for the Edit Mode Ending Event
	EditModeEndingEventArgs editEndingArgs = e.OriginalSource as
		EditModeEndingEventArgs;
	
	if (editEndingArgs == null)
		return;

 	// Column name of the field being edited (Infragistics.Windows.DataPresenter.Events)
	string columnName = editEndingArgs.Cell.Field.Name;

	// Value of the edited Cell (after edits were made)
	string newCellValue = editEndingArgs.Editor.Text;

	if (columnName == &amp;quot;Title&amp;quot; )
	{
		// Check the New Cell Value to see if it changed to anything other
		// than Sales Representative
		if (newCellValue != &amp;quot;Sales Representative&amp;quot;)
		{
			//Do not persist the changes	
			editEndingArgs.AcceptChanges = false;
			MessageBox.Show(&amp;quot;Title Must Be Sales Representative&amp;quot;);
		}
	}
}
&amp;hellip;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this case, making sure that all of the &amp;quot;Sales Representatives&amp;quot; remain &amp;quot;Sales Representatives&amp;quot; was my task.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Expanding Rich Client Experiences&lt;/h3&gt;
&lt;p&gt;After completing these steps, here is the much anticipated screenshot showing the Grid View of the XamDataPresenter inside of a Windows Forms application (minus some cool transition/animation effects).&lt;/p&gt;
&lt;p&gt;&lt;img border="0" width="568" src="http://www.infragistics.com/uploadedImages/Community/Articles/Images/WinFormsHostingWpfGrid.png" height="480" style="border:0;" alt="" /&gt; &lt;/p&gt;
&lt;p class="Figure"&gt;Next, witness this screenshot of the Carousel View of the XamDataPresenter also hosted within a Windows Forms application.&lt;/p&gt;
&lt;p class="Figure"&gt;&lt;img border="0" width="568" src="http://www.infragistics.com/uploadedImages/Community/Articles/Images/WinFormsHostingWpfCarousel.png" height="480" style="border:0;" alt="" /&gt;&lt;/p&gt;
&lt;h4&gt;A Word on Type Dependencies&lt;/h4&gt;
&lt;p&gt;Note: You&amp;#39;ll notice that I&amp;#39;m utilizing the underlying Infragistics EditModeEndingEventArgs in my Windows Forms application. This means that I need to have a reference to the Infragistics WPF assemblies in order to achieve this. If for some reason, you do not want to include a dependency on the Infragistics WPF assemblies then you can use reflection, and do something like this (although, I would recommend just using the NetAdvantage WPF Assemblies):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c897787c-1e69-4480-8618-e3e3192917bb" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;void XamDataPresenter_EditModeEnding(object sender, System.Windows.RoutedEventArgs e)
{
	//Find the Cell Object that was edited
	object cell = e.OriginalSource.GetType().GetProperty(&amp;quot;Cell&amp;quot;).GetValue(
		e.OriginalSource, null);
	
	//Get the field that the cell belongs to
	object field = cell.GetType().GetProperty(&amp;quot;Field&amp;quot;).GetValue(cell, null);

	//Get the name of the field that the cell belongs to
	string name = field.GetType().GetProperty(&amp;quot;Name&amp;quot;).GetValue(field, null) as string;
 
	//Check and see if column name is Title
	if (name == &amp;quot;Title&amp;quot;)	
	{
		//Get to the text typed by the user
		object editor = e.OriginalSource.GetType().GetProperty(&amp;quot;Editor&amp;quot;).GetValue(
		  e.OriginalSource, null);
		
		string text = editor.GetType().GetProperty(&amp;quot;Text&amp;quot;).GetValue(editor, null) as string;

		//Check to see if the text has changed from Sales Representative
		if (text != &amp;quot;Sales Representative&amp;quot;)
		{
			e.OriginalSource.GetType().GetProperty(&amp;quot;AcceptChanges&amp;quot;).SetValue(
			  e.OriginalSource, false, null);
			
			MessageBox.Show(&amp;quot;Title Must Be Sales Representative&amp;quot;);
		}
	}
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;If you&amp;#39;re a developer, do everything in Visual Studio and rely on the styling that we provide. If you have a graphic designer or need Blend interaction, then perhaps wrapping the control inside of a control library is a smarter choice, as it helps keep the separation of roles in place. &lt;/p&gt;
&lt;p&gt;Lastly, there are some limitations to the Interop story that are important to note. For instance, you can only host one child per element host control, WPF and Windows Forms have different scaling models, or it&amp;rsquo;s not possible to nest an ElementHost inside of a WindowsFormsHost or vice versa. To read a complete list of limitations you can visit &lt;a href="http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx"&gt;http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Enjoy expanding your Rich Client Experiences!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>XML Databinding with the XamDataGrid</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/21/xml-databinding-with-the-xamdatagrid</link><pubDate>Sat, 28 Feb 2009 13:10:24 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:7fe8abf6-6d92-40a7-88df-0bac6e8c903c</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 1:10:24 PM&lt;br /&gt;
&lt;h4&gt;&lt;/h4&gt;
&lt;h4&gt;XML Data File&lt;/h4&gt;
&lt;p&gt;Start with having an XML Datasource for the purpose of this example we&amp;rsquo;ll use the following and it will be stored in a separate XML File titled SalesPeople.xml:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:cc21e08c-e558-4a78-9ee1-c9c0b306520b" class="wlWriterEditableSmartContent"&gt;
&amp;lt;divre name=&amp;quot;code&amp;quot; class=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;/divre&amp;gt;&amp;lt;SalesPeople&amp;gt; &amp;lt;SalesPerson&amp;gt; &amp;lt;FirstName&amp;gt;Stephen&amp;lt;/FirstName&amp;gt; &amp;lt;LastName&amp;gt;Jiang&amp;lt;/LastName&amp;gt; &amp;lt;JobTitle&amp;gt;Sales Representative&amp;lt;/JobTitle&amp;gt; &amp;lt;City&amp;gt;Redmond&amp;lt;/City&amp;gt; &amp;lt;State&amp;gt;Washington&amp;lt;/State&amp;gt; &amp;lt;PostalCode&amp;gt;98052&amp;lt;/PostalCode&amp;gt; &amp;lt;SalesYTD&amp;gt;677588.46&amp;lt;/SalesYTD&amp;gt; &amp;lt;SalesLastYear&amp;gt;22134322.42&amp;lt;/SalesLastYear&amp;gt; &amp;lt;/SalesPerson&amp;gt; &amp;lt;SalesPerson&amp;gt; &amp;lt;FirstName&amp;gt;Michael&amp;lt;/FirstName&amp;gt; &amp;lt;LastName&amp;gt;Blythe&amp;lt;/LastName&amp;gt; &amp;lt;JobTitle&amp;gt;Sales Representative&amp;lt;/JobTitle&amp;gt; &amp;lt;City&amp;gt;Detroit&amp;lt;/City&amp;gt; &amp;lt;State&amp;gt;Michigan&amp;lt;/State&amp;gt; &amp;lt;PostalCode&amp;gt;48226&amp;lt;/PostalCode&amp;gt; &amp;lt;SalesYTD&amp;gt;4557045.04&amp;lt;/SalesYTD&amp;gt; &amp;lt;SalesLastYear&amp;gt;1740406.47&amp;lt;/SalesLastYear&amp;gt; &amp;lt;/SalesPerson&amp;gt; &amp;lt;/SalesPeople&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;XML in our Application&lt;/h4&gt;
&lt;p&gt;Next, we need to set this data up for use inside our application. In the case of this sample, &lt;br /&gt;I&amp;rsquo;ve set our XamDataGrid into a GridPanel and set the DataContext of that grid to point at our XML Data. We&amp;rsquo;ll set the source property of the XMLDataProvider equal to the file location in this case in a folder titled Data. Then we&amp;rsquo;ll set the XPath to point to our SalesPersons. This will look something like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:a9f534b0-a098-4c03-b102-57ae832117d5" class="wlWriterEditableSmartContent"&gt;
&amp;lt;divre name=&amp;quot;code&amp;quot; class=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;/divre&amp;gt;&amp;lt;Grid.DataContext&amp;gt; &amp;lt;XmlDataProvider Source=&amp;quot;Data/SalesPerson.xml XPath=&amp;quot;/SalesPeople/SalesPerson&amp;quot; /&amp;gt; &amp;lt;/Grid.DataContext&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;h4&gt;&lt;/h4&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Initial Binding to the XamDataGrid&lt;/h4&gt;
&lt;p&gt;Next, using simple WPF Binding, we can bind the xml file to the XamDataGrid:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:a67a1014-3542-4de9-bdb6-e495798d4ff3" class="wlWriterEditableSmartContent"&gt;
&amp;lt;divre name=&amp;quot;code&amp;quot; class=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;/divre&amp;gt;&amp;lt;igDP:XamDataGrid x:Name=&amp;quot;xamDataGrid1&amp;quot; DataSource=&amp;quot;{Binding}&amp;quot; /&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Customizing Field Settings&lt;/h4&gt;
&lt;p&gt;Lastly, we may want to do something like enable Summaries on the xamDataGrid and will notice that everything is being picked up as a string. To get around this we can format our data as the appropriate type by adding the Fields and associating the appropriate types to those fields. Note: We can also format the field&amp;rsquo;s labels to achieve something like &amp;ldquo;First Name&amp;rdquo; rather than &amp;ldquo;FirstName.&amp;rdquo;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:1a6f2952-ac36-4a04-b67c-1a6fd62379b0" class="wlWriterEditableSmartContent"&gt;
&amp;lt;divre name=&amp;quot;code&amp;quot; class=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;/divre&amp;gt;&amp;lt;igDP:XamDataGrid.FieldLayouts&amp;gt; &amp;lt;igDP:FieldLayout&amp;gt; &amp;lt;igDP:FieldLayout.FieldSettings&amp;gt; &amp;lt;igDP:FieldSettings AllowSummaries=&amp;quot;True&amp;quot; SummaryUIType=&amp;quot;MultiSelect&amp;quot; /&amp;gt; &amp;lt;/igDP:FieldLayout.FieldSettings&amp;gt; &amp;lt;igDP:FieldLayout.Fields&amp;gt; &amp;lt;igDP:Field Name=&amp;quot;FirstName&amp;quot; Label=&amp;quot;First Name&amp;quot; /&amp;gt; &amp;lt;igDP:Field Name=&amp;quot;LastName&amp;quot; Label=&amp;quot;Last Name&amp;quot; /&amp;gt; &amp;hellip; &amp;lt;igDP:Field Name=&amp;quot;SalesYTD&amp;quot; Label=&amp;quot;Sales YTD&amp;quot;&amp;gt; &amp;lt;igDP:Field.Settings&amp;gt; &amp;lt;igDP:FieldSettings EditAsType=&amp;quot;{x:Type sys:Double}&amp;quot; /&amp;gt; &amp;lt;/igDP:Field.Settings&amp;gt; &amp;lt;/igDP:Field&amp;gt; &amp;hellip; &amp;lt;/igDP:FieldLayout.Fields&amp;gt; &amp;lt;/igDP:FieldLayout&amp;gt; &amp;lt;/igDP:XamDataGrid.FieldLayouts&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&amp;lt;divre&amp;gt;&amp;lt;/divre&amp;gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After this our data is all set up and ready to go. We have successfully bound our grid to an XML File.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: databinding, WPF, XamDataGrid&lt;/div&gt;
</description></item><item><title>Hosting a WPF Control in a Windows Forms Application</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/20/hosting-a-wpf-control-in-a-windows-forms-application/revision/1</link><pubDate>Sat, 28 Feb 2009 12:35:01 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:32b78a89-22e7-4d30-b978-d382dc1ba763</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Revision 1 posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 12:35:01 PM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;WPF to Windows Forms Interop is one of the development strategies that will take existing applications and bring them to the future. WPF currently provides the ability to fairly easily create new experiences for visualizing applications. Windows Forms has the tools, the frameworks, and years of development effort invested into its existence. If you have a legacy application in Windows Forms and wish to add new experiences to it or better ways to visualize information; then Interop is the way to go.&lt;/p&gt;
&lt;p&gt;Infragistics has released its first WPF controls and included in this suite of controls are new metaphors for visualizing information or for that matter creating navigation items. It makes perfect sense to include these controls inside of existing Windows Forms Applications.&lt;/p&gt;
&lt;h4&gt;Adding References&lt;/h4&gt;
&lt;p&gt;To begin we&amp;#39;ll focus on the first challenge in integration, which is to get the WPF control (in this case the XamDataPresenter) into the Windows Forms Application. First you need to add references to the Microsoft WPF assemblies that handle WPF, the assemblies are as follows: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PresentationFramework &lt;/li&gt;
&lt;li&gt;PresentationCore &lt;/li&gt;
&lt;li&gt;WindowsBase &lt;/li&gt;
&lt;li&gt;WindowsFormsIntegration &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After adding references to the Microsoft assemblies, next add references to the Infragistics assemblies which include: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Infragistics3.Windows.DataPresenter.v7.1 &lt;/li&gt;
&lt;li&gt;Infragistics3.Windows.v7.1 &lt;/li&gt;
&lt;li&gt;Infragistics3.Windows.Editors.v7.1 &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Hosting the xamDataPresenter in an ElementHost for Windows Forms Apps&lt;/h3&gt;
&lt;p&gt;Next, you&amp;#39;ll need to add code to host the WPF control inside the Windows Forms application. In the case of this sample, I&amp;#39;ll perform the core logic inside of the Form_Load event. The main piece of code revolves around the ElementHost object; which is a container that is used to hold an element [e.g. WPF Control]. &lt;/p&gt;
&lt;p&gt;For the purpose of this sample, I&amp;#39;ll also create an instance of the XamDataPresenter and assign its DataSource property. Then, I&amp;#39;ll need to associate the XamDataPresenter as a child of the ElementHost object. The code will look something like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:dd367add-fa77-4137-a2b1-93fe356bc46f" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;&amp;hellip;
using System.Windows.Forms.Integration;
&amp;hellip;

namespace WindowsForms_WPF_InteropDemo
{
	public partial class Main: Form
	{
		private ElementHost XamHost;
		private Infragistics.Windows.DataPresenter.XamDataPresenter XamDP;
		&amp;hellip;

		private void Form1_Load(object sender, EventArgs e)
		{
			XamHost = new ElementHost();
			XamHost.Dock = DockStyle.Fill;
			this.Controls.Add(XamHost);
			XamDP = new Infragistics.Windows.DataPresenter.XamDataPresenter();
			XamDP.DataSource = this.vSalesPersonSalesByFiscalYearsBindingSource;
			XamHost.Child = XamDP;

		}
&amp;hellip;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p class="Figure"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This implementation is fairly easy to achieve, gives us access to the full XamDataPresenter object model and it was only a few lines of code. This will enable developers to fully target the control inside of Visual Studio.&lt;/p&gt;
&lt;h2&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Designing for WPF &amp;ndash; Building for Windows Forms&lt;/h3&gt;
&lt;p&gt;One of the core concepts for WPF development was the separation of Design from Development. This means you might want to open up the XamDataPresenter inside of Blend and style it in order to fully achieve the experience that you wish to deliver. Now, you could do all of the work on a &amp;#39;dummy&amp;#39; control inside of Blend and cut-copy-paste the XAML code into your Windows Forms project, but that isn&amp;#39;t really a good scenario and breaks down the communication between the two tooling environments and if I want to fully utilize the power of WPF styling capabilities then I should look for another approach. &lt;/p&gt;
&lt;p&gt;One way to get around the problem that I&amp;#39;ve mentioned is to create a WPF Control Library that hosts the XamDataPresenter. This will enable me to fully design the control inside of Blend and I will be able to host the ControlLibrary as the control inside of ElementHost within Visual Studio. (Note: Control Libraries can be built in Blend, but unless you add them to a dummy project they cannot be tested/run.) &lt;/p&gt;
&lt;p&gt;The first challenge I will face is that there is no assigned data source; to get around this I can create a simple XML file that mimics my datasource and I can use that as an intermediate step to style my XamDataPresenter or I can set the BindToSampleData property which will fill my XamDataPresenter with a generic set of data and enable me to focus purely on the styling aspects of the control. That being said, I now have all of the abilities as a designer like the ability to visually style the control and add custom presenters. &lt;/p&gt;
&lt;p&gt;After making all of the design changes, I can simply build my project and either a.) add the project to my Windows Forms Solution or b.) add the DLL for my custom control to the references in the Windows Forms Project.&lt;/p&gt;
&lt;h4&gt;Exposing WPF Properties&lt;/h4&gt;
&lt;p&gt;Inside of Visual Studio, I associate the UserControl to the element host by following the same process as previously noted. I will notice that there is no DataSource property, and in fact, none of the familiar properties that I had in my first sample are there. As a matter of fact, I am now seeing all of the properties of the UserControl and not that of the XamDataPresenter. The ideal solution is to have both the ability to design in Blend and code inside of Visual Studio. To achieve this, I&amp;#39;ll have to add some code to my UserControl that exposes the underlying properties of the XamDataPresenter. &lt;/p&gt;
&lt;p&gt;To begin, I&amp;#39;ll start by adding a public property to my UserControl that lets me access the datasource property of the XamDataPresenter. The code might look something like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:2560a87f-ab84-4816-842d-d31174229ea8" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;public System.Collections.IEnumerable DataSource
{
	get { return this.XamDataPresenterInternal.DataSource; }
	set { this.XamDataPresenterInternal.DataSource = value; }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;&lt;br /&gt;Listening to WPF Events&lt;/h4&gt;
&lt;p&gt;Theoretically, I can expose all of the properties I need on the underlying XamDataPresenter by associating them as public properties of the usercontrol. Aside from properties, I may also need to expose some events to my base project. In this sample, I&amp;#39;ll add some events that validate cell values before exiting edit mode on a grid cell. Since, the EditModeEndingEvent will not be available in my Windows Forms Application, I&amp;#39;ll create a public event off of the user control that will handle the event off of the underlying XamDataPresenter and let me act on it inside of my Windows Forms Application. The following code will be placed in my .xaml.cs file:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:73ebd821-88f8-49ac-a5aa-4754de82662e" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;public static RoutedEvent EditModeEndingEvent = EventManager.RegisterRoutedEvent
   (&amp;quot;EditModeEnding&amp;quot;, RoutingStrategy.Bubble, typeof(RoutedEventHandler),
   typeof(XamDataPresenterWrapper));

public event RoutedEventHandler EditModeEnding
{
	add { AddHandler(EditModeEndingEvent, value); }
	remove { RemoveHandler(EditModeEndingEvent, value); }
}

 
void XamDataPresenterInternal_EditModeEnding(object sender,
   Infragistics.Windows.DataPresenter.Events.EditModeEndingEventArgs e)
{
  RaiseEvent(new
     RoutedEventArgs(XamDataPresenterWrapper.EditModeEndingEvent, e));
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, make sure that the .xaml file knows of the event:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:47fa5f77-a9ca-485e-9147-9c60ef4e4194" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataPresenter Name=&amp;quot;XamDataPresenterInternal&amp;quot;
 EditModeEnding=&amp;quot;XamDataPresenterInternal_EditModeEnding&amp;quot;/&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Connecting the WPF Control Library to the Windows Forms Project&lt;/h4&gt;
&lt;p&gt;Now that I&amp;#39;ve handled these changes to my ControlLibrary, I&amp;#39;m going to build it and then jump back into my Windows Forms Project and start hooking everything up. To begin, I&amp;#39;ll start by hooking up the DataSource Property:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:3094401c-bd98-486a-bfd2-723a46e628dd" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;&amp;hellip;
using System.Windows.Forms.Integration;
&amp;hellip;

namespace WindowsForms_WPF_InteropDemo
{
	public partial class Main: Form
	{
		private ElementHost XamHost;
		private Infragistics.XamDataPresenterWrapper XamDataPresenter;
		&amp;hellip;
		private void Main_Load(object sender, EventArgs e)
		{
			&amp;hellip;
			XamHost = new ElementHost();
			XamHost.Dock = DockStyle.Fill;
			this.Controls.Add(XamHost);
			XamDataPresenter = new Infragistics.XamDataPresenterWrapper();
			XamDataPresenter.DataSource =
				this.vSalesPersonSalesByFiscalYearsBindingSource;
			XamHost.Child = XamDataPresenter;
		}

&amp;hellip;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;After completing this work item, I can hook up the event and perform any logic in that event that I need to handle. For the purpose of this sample, I&amp;#39;ll add the event handler to the (Main_Load) Form_Load event and then I&amp;#39;ll add the code to perform whatever logic is needed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:834a7fdf-b192-4c58-8784-fe9e924ebc91" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;&amp;hellip;
using Infragistics.Windows.DataPresenter.Events;
&amp;hellip;

XamDataPresenter.EditModeEnding += 
  new System.Windows.RoutedEventHandler(XamDataPresenter_EditModeEnding);

&amp;hellip;

void XamDataPresenter_EditModeEnding(object sender, System.Windows.RoutedEventArgs e)
{
	// Arguments for the Edit Mode Ending Event
	EditModeEndingEventArgs editEndingArgs = e.OriginalSource as
		EditModeEndingEventArgs;
	
	if (editEndingArgs == null)
		return;

 	// Column name of the field being edited (Infragistics.Windows.DataPresenter.Events)
	string columnName = editEndingArgs.Cell.Field.Name;

	// Value of the edited Cell (after edits were made)
	string newCellValue = editEndingArgs.Editor.Text;

	if (columnName == &amp;quot;Title&amp;quot; )
	{
		// Check the New Cell Value to see if it changed to anything other
		// than Sales Representative
		if (newCellValue != &amp;quot;Sales Representative&amp;quot;)
		{
			//Do not persist the changes	
			editEndingArgs.AcceptChanges = false;
			MessageBox.Show(&amp;quot;Title Must Be Sales Representative&amp;quot;);
		}
	}
}
&amp;hellip;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this case, making sure that all of the &amp;quot;Sales Representatives&amp;quot; remain &amp;quot;Sales Representatives&amp;quot; was my task.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Expanding Rich Client Experiences&lt;/h3&gt;
&lt;p&gt;After completing these steps, here is the much anticipated screenshot showing the Grid View of the XamDataPresenter inside of a Windows Forms application (minus some cool transition/animation effects).&lt;/p&gt;
&lt;p&gt;&lt;img border="0" width="568" src="http://community.infragistics.com/uploadedImages/Community/Articles/Images/WinFormsHostingWpfGrid.png" height="480" alt="" /&gt; &lt;/p&gt;
&lt;p class="Figure"&gt;Next, witness this screenshot of the Carousel View of the XamDataPresenter also hosted within a Windows Forms application.&lt;/p&gt;
&lt;p class="Figure"&gt;&lt;img border="0" width="568" src="http://community.infragistics.com/uploadedImages/Community/Articles/Images/WinFormsHostingWpfCarousel.png" height="480" alt="" /&gt;&lt;/p&gt;
&lt;h4&gt;A Word on Type Dependencies&lt;/h4&gt;
&lt;p&gt;Note: You&amp;#39;ll notice that I&amp;#39;m utilizing the underlying Infragistics EditModeEndingEventArgs in my Windows Forms application. This means that I need to have a reference to the Infragistics WPF assemblies in order to achieve this. If for some reason, you do not want to include a dependency on the Infragistics WPF assemblies then you can use reflection, and do something like this (although, I would recommend just using the NetAdvantage WPF Assemblies):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c897787c-1e69-4480-8618-e3e3192917bb" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;void XamDataPresenter_EditModeEnding(object sender, System.Windows.RoutedEventArgs e)
{
	//Find the Cell Object that was edited
	object cell = e.OriginalSource.GetType().GetProperty(&amp;quot;Cell&amp;quot;).GetValue(
		e.OriginalSource, null);
	
	//Get the field that the cell belongs to
	object field = cell.GetType().GetProperty(&amp;quot;Field&amp;quot;).GetValue(cell, null);

	//Get the name of the field that the cell belongs to
	string name = field.GetType().GetProperty(&amp;quot;Name&amp;quot;).GetValue(field, null) as string;
 
	//Check and see if column name is Title
	if (name == &amp;quot;Title&amp;quot;)	
	{
		//Get to the text typed by the user
		object editor = e.OriginalSource.GetType().GetProperty(&amp;quot;Editor&amp;quot;).GetValue(
		  e.OriginalSource, null);
		
		string text = editor.GetType().GetProperty(&amp;quot;Text&amp;quot;).GetValue(editor, null) as string;

		//Check to see if the text has changed from Sales Representative
		if (text != &amp;quot;Sales Representative&amp;quot;)
		{
			e.OriginalSource.GetType().GetProperty(&amp;quot;AcceptChanges&amp;quot;).SetValue(
			  e.OriginalSource, false, null);
			
			MessageBox.Show(&amp;quot;Title Must Be Sales Representative&amp;quot;);
		}
	}
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;If you&amp;#39;re a developer, do everything in Visual Studio and rely on the styling that we provide. If you have a graphic designer or need Blend interaction, then perhaps wrapping the control inside of a control library is a smarter choice, as it helps keep the separation of roles in place. &lt;/p&gt;
&lt;p&gt;Lastly, there are some limitations to the Interop story that are important to note. For instance, you can only host one child per element host control, WPF and Windows Forms have different scaling models, or it&amp;rsquo;s not possible to nest an ElementHost inside of a WindowsFormsHost or vice versa. To read a complete list of limitations you can visit &lt;a href="http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx"&gt;http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Enjoy expanding your Rich Client Experiences!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, Windows Forms, Interop&lt;/div&gt;
</description></item><item><title>Tangerine -- A WPF Reference Application</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/19/tangerine-a-wpf-reference-application</link><pubDate>Sat, 28 Feb 2009 12:31:54 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:7c6ab306-08ed-45e9-903a-15360a39edd4</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 12:31:54 PM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Use Tangerine&amp;trade;, our first reference application for WPF, to not only learn WPF and &lt;a href="http://www.infragistics.com/dotnet/netadvantage/wpf.aspx#Overview"&gt;NetAdvantage for WPF&lt;/a&gt; but also to learn good practices for enterprise application development across the board. This solution provides a full application, including complete source code, as well as several accompanying papers to help guide you in your application development. In addition to using it as a learning tool, the solution has been architected in such a way as to make it easy for you to reuse it in your own development, either in whole or in part.&lt;/p&gt;
&lt;p&gt;Tangerine v1.1 is a WPF-based asset browser application. It has a pluggable architecture so that you can provide any number of different back-end asset providers while reusing the same snazzy UI that&amp;#39;s based on Infragistics NetAdvantage for WPF toolset. In our first release, we have supplied an &lt;a href="http://www.amazon.com/E-Commerce-Service-AWS-home-page/b/ref=sc_fe_l_2/104-2910409-3551969?ie=UTF8&amp;amp;node=12738641&amp;amp;no=342430011&amp;amp;me=A36L942TSJ2AJA"&gt;Amazon Web Services&amp;#39; E-Commerce Service&lt;/a&gt; provider so that you can use the application to browse and search the Amazon.com catalog. You can use the links below to both run the application (via ClickOnce deployment) now or download the solution and papers.&lt;/p&gt;
&lt;p&gt;To learn more about the solution, check out &lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Introducing%20Tangerine.pdf"&gt;Introducing Tangerine&lt;/a&gt;, which describes the tools we used to build Tangerine as well as an overview of its accompanying papers.&lt;/p&gt;
&lt;h2&gt;&lt;img width="632" src="http://download.infragistics.com/community/wpf/articles/Tangerine.png" height="480" alt="" /&gt;&amp;nbsp;&amp;nbsp;&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.infragistics.com/launch-tangerine"&gt;&lt;strong&gt;Experience Tangerine Now&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Experience Tangerine now via ClickOnce deployment. Double-check your computer meets the minimum requirements prior to launching.&lt;/p&gt;
&lt;p&gt;Minimum Requirements to Run:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows Vista&amp;reg; or Windows&amp;reg; Server 2008 &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Windows XP &amp;amp; Windows Server 2003 Users: Verify you have the &lt;a href="http://www.infragistics.com/uploadedImages/Community/Exemplars/Images/verify_netfx3.jpg"&gt;.NET Framework 3.0&lt;/a&gt; or &lt;a href="http://www.infragistics.com/uploadedimages/Community/Exemplars/Images/verify_netfx35.jpg"&gt;.NET Framework 3.5&lt;/a&gt; installed&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://www.infragistics.com/download-tangerine"&gt;&lt;strong&gt;Get Tangerine&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Generally speaking, the only tool you need in addition to all the usual stuff needed to develop WPF is &lt;a href="http://wwww.infragistics.com/dotnet/netadvantage/wpf.aspx"&gt;NetAdvantage for WPF&lt;/a&gt;. If you don&amp;#39;t own it, you can &lt;a href="http://www.infragistics.com/dotnet/netadvantage/wpfdownloads.aspx"&gt;download a trial for free&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Minimum Requirements for Development:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/vs2008/default.aspx"&gt;Microsoft Visual Studio 2008&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en"&gt;.NET Framework 3.0&lt;/a&gt; or &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=333325FD-AE52-4E35-B531-508D977D32A6&amp;amp;displaylang=en"&gt;.NET Framework 3.5&lt;/a&gt; (installed by default on Windows Vista and Windows Server 2008) &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://www.infragistics.com/dotnet/netadvantage/wpf.aspx"&gt;Infragistics NetAdvantage for WPF&lt;/a&gt; (trial or registered will work) &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Delve into Tangerine&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The best way to really dive into Tangerine is to go ahead and &lt;a href="http://www.infragistics.com/download-tangerine"&gt;download the complete solution&lt;/a&gt; so that you can explore the code. However, for your convenience, you can delve into the accompanying papers online.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Introducing Tangerine&lt;/strong&gt; (&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Introducing%20Tangerine.pdf"&gt;PDF&lt;/a&gt;/&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Introducing%20Tangerine.xps"&gt;XPS&lt;/a&gt;) [~1.2 MB] - The best way to get started learning about the solution. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Story&lt;/strong&gt; (&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Story.pdf"&gt;PDF&lt;/a&gt;/&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Story.xps"&gt;XPS&lt;/a&gt;) [~800 KB] - Tells the story of the application&amp;#39;s development, including key decisions and problems solved along the way. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vision &amp;amp; Scope&lt;/strong&gt; (&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Vision%20&amp;amp;%20Scope.pdf"&gt;PDF&lt;/a&gt;/&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Vision%20&amp;amp;%20Scope.xps"&gt;XPS&lt;/a&gt;) [~410 KB] - The original, unaltered vision &amp;amp; scope document that started the development process that you can use as an example and to get a feel for how the application changed over time. It is an artifact of the application&amp;#39;s development. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Requirements&lt;/strong&gt; (&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Requirements.pdf"&gt;PDF&lt;/a&gt;/&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Requirements.xps"&gt;XPS&lt;/a&gt;) [~650 KB] - The original, unaltered requirements document that can be used as an example of how to do scenario-based requirements without falling into the rut of prescribing an implementation. It is another artifact of our development. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Architecture&lt;/strong&gt; (&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Architecture.pdf"&gt;PDF&lt;/a&gt;/&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Architecture.xps"&gt;XPS&lt;/a&gt;) [~700 KB] - An architectural overview of the solution&amp;mdash;a good starting point before delving into the code. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Perspectives on WPF&lt;/strong&gt; (&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Perspectives%20On%20WPF.pdf"&gt;PDF&lt;/a&gt;/&lt;a href="http://www.infragistics.com/uploadedFiles/Community/Downloads/7471/Perspectives%20On%20WPF.xps"&gt;XPS&lt;/a&gt;) [~370 KB] - Discusses learning WPF from the viewpoint of different developer/designer roles. &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, Reference Application, XamDataGrid, xamDataCarousel&lt;/div&gt;
</description></item><item><title>Using the Infragistics WinGrid in a WPF Application</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/17/using-the-infragistics-wingrid-in-a-wpf-application</link><pubDate>Sat, 28 Feb 2009 11:48:41 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:4bf169f6-ebc1-4569-8f91-d09209735790</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 11:48:41 AM&lt;br /&gt;
&lt;p&gt;In some scenarios, developers may find themselves in a situation where they are using the Infragistics WinGrid wrapped with some pretty intensive business logic that is going to take a good deal of time to recreate. One possibility that the developer can use is to continue forward with a WPF application and simply re-use the WinGrid in that application. This article demonstrates the necessary libraries to do that.&lt;/p&gt;
&lt;p&gt;The first thing that needs to be done is to add references to the WindowsFormsIntegration dll and if you have a separate project hosting your WinForms control include that as well. With the addition of this WindowsFormsIntegration dll, you will be able to add a WindowsFormsHost component to your WPF application. To Display your Windows Forms control simply set the Child property and ensure you have a reference to the control. The following code snippet shows a WinGrid and a Carousel on the same Window.&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:99226aa7-dc6a-46ef-bc9e-db1e5859e357" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;Window x:Class=&amp;quot;XamWinFormsInteropSample.Window1&amp;quot;
    xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    Title=&amp;quot;Window1&amp;quot; Height=&amp;quot;517&amp;quot; Width=&amp;quot;680&amp;quot;
        xmlns:igDP=&amp;quot;http://infragistics.com/DataPresenter&amp;quot;
        xmlns:WinGrid=&amp;quot;clr-namespace:xamWinGrid;assembly=xamWinGrid&amp;quot;
 	  Loaded=&amp;quot;Window_Loaded&amp;quot;&amp;gt;
    &amp;lt;Grid x:Name=&amp;quot;MainGrid&amp;quot;&amp;gt;
        &amp;lt;Grid.RowDefinitions&amp;gt;
            &amp;lt;RowDefinition Height=&amp;quot;162*&amp;quot; /&amp;gt;
            &amp;lt;RowDefinition Height=&amp;quot;100*&amp;quot; /&amp;gt;
        &amp;lt;/Grid.RowDefinitions&amp;gt;
        &amp;lt;WindowsFormsHost Name=&amp;quot;windowsFormsHost1&amp;quot;&amp;gt;
            &amp;lt;WinGrid:xamWinGrid x:Name=&amp;quot;xamWinGrid1&amp;quot; /&amp;gt;
        &amp;lt;/WindowsFormsHost&amp;gt;
        &amp;lt;igDP:XamDataCarousel Name=&amp;quot;xamDataPresenter1&amp;quot; Grid.Row=&amp;quot;1&amp;quot; /&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;One other thing that can be done is in the user-control for the WindowsForms control; you can have a public property that exposes anything on the underlying controls that you may want to have access to in the WPF application. In this example, I will expose the DataSource property so that I can bind to a NorthWind dataset:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:63d00e5f-9870-415a-9c7e-61d281632c50" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;//Windows Forms User-Control
public System.Collections.IEnumerable DataSource
{
set
      {
      	this.ultraGrid1.DataSource = value;
}
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To set up binding in a hybrid scenario, you can use the System.Windows.Forms.BindingSource control. An example from Microsoft is well documented here: &lt;a href="http://msdn.microsoft.com/en-us/library/ms742687.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms742687.aspx&lt;/a&gt; . That sample is the basis for the binding listed in this sample:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5f833752-888e-43b6-9351-5eac9b317e21" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;//WPF Application
private System.Windows.Forms.BindingSource nwBindingSource;
private NwindDataSet nwDataSet;
private NwindDataSetTableAdapters.CustomersTableAdapter customersTableAdapter = 
    new XamWinFormsInteropSample.NwindDataSetTableAdapters.CustomersTableAdapter();

        
public Window1()
{
InitializeComponent();
      this.nwDataSet = new NwindDataSet();
      this.nwDataSet.DataSetName = &amp;quot;nwDataSet&amp;quot;;

      this.nwBindingSource = new System.Windows.Forms.BindingSource();
      this.nwBindingSource.DataSource = this.nwDataSet;

}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.customersTableAdapter.ClearBeforeFill = true;
      this.customersTableAdapter.Fill(this.nwDataSet.Customers);

 	this.MainGrid.DataContext = this.nwBindingSource;
      this.xamDataPresenter1.DataSource = this.nwBindingSource;
      this.xamWinGrid1.DataSource = this.nwBindingSource;

      BindingListCollectionView cv = 
CollectionViewSource.GetDefaultView(this.nwBindingSource) as 
BindingListCollectionView;

cv.CurrentChanged += new EventHandler(cv_CurrentChanged);
            
}

void cv_CurrentChanged(object sender, EventArgs e)
{
BindingListCollectionView cv = sender as BindingListCollectionView;
      this.nwBindingSource.Position = cv.CurrentPosition;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;After doing this, you have officially included a Windows Forms Control in your WPF Application: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://download.infragistics.com/community/wpf/articles/interop.png" alt="" /&gt; &lt;/p&gt;
&lt;p&gt;For additional information on this subject check out these links:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Property Mapping: &lt;a href="http://msdn.microsoft.com/en-us/library/ms788729.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms788729.aspx&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;General Issues with Interop: &lt;a href="http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx"&gt;http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, WinGrid, Windows Forms, Interop&lt;/div&gt;
</description></item><item><title>Printing the XamDataGrid with Infragistics.Reports</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/14/printing-the-xamdatagrid-with-infragistics-reports</link><pubDate>Sat, 28 Feb 2009 11:36:18 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:443fb640-e4ce-48a2-9979-6cad299065e4</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 11:36:18 AM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Infragistics.Reports is an extremely versatile and powerful code library included in the NetAdvantage for WPF product. Initially, it was created to enable developers an easy mechanism for printing the XamDataGrid or exporting it to XPS. As the control API took shape, new capabilities emerged granting the developer the ability to customize the document by adding header/footers or custom graphics. As we looked at ways for how to push stuff to the printer, it became apparent that we could just print the entire window or place basically any visual element out to the printer. This gives the ability to push the chart or images or whatever you want out. Then some helper controls were added to the library, things to help with the full document printing/exporting experience such as a Print Preview control. This article demonstrates the usage of printing the XamDataGrid and associating a report to the printer.&lt;/p&gt;
&lt;h4&gt;Setting up Infragistics.Reports&lt;/h4&gt;
&lt;p&gt;The first thing that you have to do is add a reference to the Infragistics3.Wpf.Reporting dll. This holds all the critical pieces to write out to the printer/XPS document. Then you need to new up a Report class. This is the piece that is going to be printed. A report consists of a collection of sections. Each of these sections can hold some type of content. A key class that will be most useful is the Infragistics.Windows.Reports.EmbeddedVisualReportSection as this will easily map any visual element to a section.&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:126b0f14-08f8-4f17-af95-1176dd37949b" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;Infragistics.Windows.Reporting.Report myReport = new  
   Infragistics.Windows.Reporting.Report();

Infragistics.Windows.Reporting.EmbeddedVisualReportSection 
myXamDataGridReport = new
Infragistics.Windows.Reporting.EmbeddedVisualReportSection(this.xamDataGrid1);

myReport.Sections.Add(myXamDataGridReport);
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Print Preview&lt;/h4&gt;
&lt;p&gt;The next thing that you can do is to actually send your printed document to a print preview dialog. Infragistics has created a control (XamReportPreview) to accomplish this. To use it, you can add the control to your WPF Application like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:056511ba-a268-4c9c-8102-a74ef876a9e5" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;Window x:Class=&amp;quot;XamCommunitySample.MainWindow1&amp;quot;
&amp;hellip;
        xmlns:igReports=&amp;quot;http://infragistics.com/Reporting&amp;quot;
&amp;hellip; &amp;gt;
&amp;hellip;
    &amp;lt;igReports:XamReportPreview x:Name=&amp;quot;xamReportPreview1&amp;quot; /&amp;gt;
&amp;hellip;
&amp;lt;/Window&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;C#&lt;/strong&gt;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:58a94668-6790-48ae-9ed4-74a11e648d56" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;//Method Signature GeneratePreview(Report, bool showPrintDialog, bool showReportProgressControl);
xamReportPreview1.GeneratePreview(myReport, false, true);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You can notice that we are using the xamReportPreview control&amp;rsquo;s GeneratePreview method and passing it the Report we just created. The method signature actually has a couple extra parameters that will help with the actual experience of the printing experience. The parameters are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Infragistics.Windows.Reports.Report &amp;ndash; The Report that the developer wants to print/print preview &lt;/li&gt;
&lt;li&gt;bool ShowPrintDialog &amp;ndash; This shows the standard PrintPreviewDialog that enables the application&amp;rsquo;s consumer to configure the printer and print location. &lt;/li&gt;
&lt;li&gt;bool ShowReportProgressControl &amp;ndash; this is a helper that will generate a dialog that will give the application&amp;rsquo;s consumer a status on the status of the print preview being generated. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Printing&lt;/h4&gt;
&lt;p&gt;Lastly, there are two other methods that are core to the printing of a document; Export and Print. These two methods do essentially exactly what they describe send a document to the printer or export a document to XPS. The code do to do this looks something like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:831f10ee-152d-42f7-a200-05fbb5389519" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;myReport.Print();

myReport.Export(Infragistics.Windows.Reporting.OutputFormat.XPS, 
  &amp;quot;FileLocation&amp;quot;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;That&amp;rsquo;s it. With that small amount of code, you have successfully printed or exported your XamDataGrid or any Visual Element.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" width="640" src="http://download.infragistics.com/community/wpf/articles/PrintPreview.png" title="Print Preview" alt="" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Infragistics.Reports&lt;/div&gt;
</description></item><item><title>Defining a Custom Path in the XamCarousel</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/13/defining-a-custom-path-in-the-xamcarousel</link><pubDate>Sat, 28 Feb 2009 11:29:08 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:8d058480-55ca-4c1d-9077-3c413061f464</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 11:29:08 AM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The XamCarousel line of controls brings the sizzle of WPF to the client developer. It makes it easy to create navigation views or data-bound contact rolodexes. This tutorial will demonstrate how to define a custom path upon which the carousel items will arrange themselves.&lt;/p&gt;
&lt;h4&gt;Creating a Custom Path&lt;/h4&gt;
&lt;p&gt;First step, is to define your custom path. This can be achieved by using the Pen Tool in Blend and having a little fun drawing. Essentially, what you are working on is getting the data from the path property and re-use it in your Carousel.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://download.infragistics.com/community/wpf/articles/CustomPath.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;In XAML that path looks like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:023de94f-226b-4017-93ef-7a8fe7f6ea3c" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;Path x:Name=&amp;quot;myPath&amp;quot;  Margin=&amp;quot;0,0,0,0&amp;quot; HorizontalAlignment=&amp;quot;Left&amp;quot; 
      VerticalAlignment=&amp;quot;Top&amp;quot; Height=&amp;quot;Auto&amp;quot; Width=&amp;quot;Auto&amp;quot; Stretch=&amp;quot;Fill&amp;quot; 
      Data=&amp;quot;M8,210.04 C83.5,85.541096 177.5,84.54052 236.5,204.53999 295.5,
      324.54002 398.5,251.53956 409.5,210.53999 466.5,84.541153 561.5,88.54112 
      609.5,212.54011&amp;quot; 
      Stroke=&amp;quot;#FF0000&amp;quot; StrokeThickness=&amp;quot;1&amp;quot; /&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Assigning the Custom Path to the Carousel&lt;/h4&gt;
&lt;p&gt;After the path is drawn, initialize one of the XamCarousel controls. In the case of this sample, we are going to add a custom path to our XamCarouselPanel which will host a series of images. The XAML code looks like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:bf13d94f-3c67-4bb4-9c6c-ccaa914aff81" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igWindows:XamCarouselPanel Margin=&amp;quot;0,0,0,0&amp;quot;&amp;gt;
    &amp;lt;igWindows:XamCarouselPanel.ViewSettings&amp;gt;
          &amp;lt;igWindows:CarouselViewSettings IsListContinuous=&amp;quot;True&amp;quot;/&amp;gt;
   &amp;lt;/igWindows:XamCarouselPanel.ViewSettings&amp;gt;
   &amp;lt;Image Source=&amp;quot;Images/Autumn Leaves.jpg&amp;quot; Width=&amp;quot;130&amp;quot; /&amp;gt;
   &amp;lt;Image Source=&amp;quot;Images/Creek.jpg&amp;quot; Width=&amp;quot;130&amp;quot; /&amp;gt;
    &amp;hellip;
&amp;lt;/igWindows:XamCarouselPanel&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Next, we need to make a quick resource that will house our path definition. We can simply copy our above path into the &amp;lt;Grid.Resources&amp;gt; &amp;lt;Path x:key=&amp;rdquo;myPath&amp;rdquo;&amp;hellip; /&amp;gt; &amp;lt;/Grid.Resources&amp;gt; and assign a x:key name to the Path. &lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:894c347b-8ad9-4c36-bf63-559fd6098762" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igWindows:CarouselViewSettings IsListContinuous=&amp;quot;True&amp;quot; 
           ItemPath=&amp;quot;{StaticResource myPath}&amp;quot; ItemsPerPage=&amp;rdquo;7&amp;rdquo;/&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And that&amp;rsquo;s it, after that we have officially styled the xamCarousel to follow our custom path!&lt;/p&gt;
&lt;p&gt;&lt;img src="http://download.infragistics.com/community/wpf/articles/xamCarouselPath.png" alt="" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: XamCarouselPanel, XamCarouseLlistbox, WPF, xamDataCarousel&lt;/div&gt;
</description></item><item><title>Creating a Custom Summary for the XamDataGrid</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/11/creating-a-custom-summary-for-the-xamdatagrid</link><pubDate>Sat, 28 Feb 2009 11:13:39 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:5561be5a-5c7f-4451-a3c8-a766426b8644</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 11:13:39 AM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The XamDataGrid Row Summary functionality allows for a lot of flexibility. It enables developers to easily expose basic summary information to their consumers with a simple property setting as demonstrated &lt;i&gt;&lt;a href="http://community.infragistics.com/wpf/articles/enabling-row-summaries-in-the-xamdatagrid.aspx"&gt;here&lt;/a&gt;&lt;/i&gt;. In some situations, a developer may want to either have more control over a summary result or create their own business specific formula.&lt;/p&gt;
&lt;p&gt;This article will look at information stored in a DataGrid and given a particular sales person calculate who sold the most for a given year and then integrate that summary into the xamDataGrid.&lt;/p&gt;
&lt;h4&gt;Create a Custom Summary Class&lt;/h4&gt;
&lt;p&gt;To begin, create a custom class titled TopSalesPerson and add to that class two imports/using statements and inherit from SummaryCalculator:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:621060d0-43cd-4db1-838b-e0be27d0b734" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;using Infragistics.Windows.DataPresenter;
using Infragistics.Windows;
&amp;hellip;
namespace XamCommunitySample
{     	
    class TopSalesPerson : SummaryCalculator
    {
        private string _currentTopSalesPerson;
  private double _currentTopSalesAmount;
    }
}
&lt;/pre&gt;
&lt;p&gt;Next implement the BeginCalculation Method to initialize your variables:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f207953f-99e3-42b6-835d-f6678e3b0c1f" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override void BeginCalculation(SummaryResult summaryResult)
{
   _currentTopSalesAmount = 0;
   _currentTopSalesPerson = string.Empty;
}
&lt;/pre&gt;
&lt;p&gt;Next, implement the CanProcessDataType to tell the calculator to only calculate for numeric types:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:4007e3c5-b4b3-485f-bc07-568b8d2bcdd9" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override bool CanProcessDataType(Type dataType)
{
   return Utilities.IsNumericType(dataType);
}
&lt;/pre&gt;
&lt;p&gt;The next part deals with the core part of our custom business logic in the aggregate method. The aggregate method essentially loops over every record in the xamDataGrid and gives you access to that Record as well as to the value in the current calculating column for that particular record. For our sample, we&amp;rsquo;re going to keep tabs on the current sales leader in a given category and as we find a leader update our string with that person&amp;rsquo;s name.&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:1895961d-5586-4b62-90b4-077fb2d80631" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override void Aggregate(object dataValue, SummaryResult summaryResult, 
  Record record)
{
  double myCellValue = double.Parse(dataValue.ToString());
  DataRecord myCurrentRecord = record as DataRecord;

  if (myCellValue  &amp;gt; _currentTopSalesAmount)
  {
     _currentTopSalesAmount = myCellValue;
     _currentTopSalesPerson = 
      myCurrentRecord.Cells[&amp;quot;FirstName&amp;quot;].Value.ToString() + &amp;quot; &amp;quot; +   
      myCurrentRecord.Cells[&amp;quot;LastName&amp;quot;].Value.ToString();
    }
}
&lt;/pre&gt;
&lt;p&gt;After we&amp;rsquo;ve implemented this method, we only have a couple of steps in our calculation class to go. The first one, is to return the Winning Sales Persons name. The second is to name our custom calculation function and give it a description. The name is what will display in the dropdown box at run-time in the datagrid.&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:98937f1f-e45b-49e7-b32c-f555fc7dbccf" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override object EndCalculation(SummaryResult summaryResult)
{
   return _currentTopSalesPerson;
}

public override string Name
{
   get { return &amp;quot;Sales Leader&amp;quot;; }
}

public override string Description
{
    get { return &amp;quot;Top Sales Person&amp;quot;; }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Link the Custom Summary to the Application&lt;/h4&gt;
&lt;p&gt;Almost finished, now we can assign our new custom summary to our application by inserting it into our window_loaded method:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:d480a253-e5ea-42c8-95d7-13afb99e3a44" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;private void Window_Loaded(object sender, RoutedEventArgs e)
{
   TopSalesPerson Summary = new TopSalesPerson();
   SummaryCalculator.Register(Summary);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Lastly, the developer may want to show their custom summary on a specific field without placing it on every column. For instance, we may have a Quota column and a Sales column; the end-user would expect to see who the top sales person was, but maybe not who had the highest quota. This can be achieved by not registering our summary like demonstrated above, but by associating a specific summary definition with a given column:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:7dc2a76c-ac78-46cb-9558-8588606d1038" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;TopSalesPerson Summary = new TopSalesPerson();
     
SummaryDefinition myTopSalesPersonFormula = new SummaryDefinition();
myTopSalesPersonFormula.SourceFieldName = &amp;quot;SalesYTD&amp;quot;;
myTopSalesPersonFormula.Calculator = Summary;
this.xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Add(myTopSalesPersonFormula);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;In closing, the summary capabilities of the DataPresenter off ease of use in the pre-built commonly used formulas and flexibility in the ability to quickly add custom formulas to the DataGrid.&lt;/p&gt;
&lt;p&gt;&lt;img width="570" src="http://download.infragistics.com/community/andrewf/images/CustomSummary.png" height="400" alt="" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Aggregation&lt;/div&gt;
</description></item><item><title>Creating a Custom Summary for the XamDataGrid</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/11/creating-a-custom-summary-for-the-xamdatagrid/revision/1</link><pubDate>Sat, 28 Feb 2009 11:12:24 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:5561be5a-5c7f-4451-a3c8-a766426b8644</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Revision 1 posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 11:12:24 AM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The XamDataGrid Row Summary functionality allows for a lot of flexibility. It enables developers to easily expose basic summary information to their consumers with a simple property setting as demonstrated &lt;i&gt;&lt;a href="http://community.infragistics.com/wpf/articles/enabling-row-summaries-in-the-xamdatagrid.aspx"&gt;here&lt;/a&gt;&lt;/i&gt;. In some situations, a developer may want to either have more control over a summary result or create their own business specific formula.&lt;/p&gt;
&lt;p&gt;This article will look at information stored in a DataGrid and given a particular sales person calculate who sold the most for a given year and then integrate that summary into the xamDataGrid.&lt;/p&gt;
&lt;h4&gt;Create a Custom Summary Class&lt;/h4&gt;
&lt;p&gt;To begin, create a custom class titled TopSalesPerson and add to that class two imports/using statements and inherit from SummaryCalculator:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:621060d0-43cd-4db1-838b-e0be27d0b734" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;using Infragistics.Windows.DataPresenter;
using Infragistics.Windows;
&amp;hellip;
namespace XamCommunitySample
{     	
    class TopSalesPerson : SummaryCalculator
    {
        private string _currentTopSalesPerson;
  private double _currentTopSalesAmount;
    }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next implement the BeginCalculation Method to initialize your variables:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f207953f-99e3-42b6-835d-f6678e3b0c1f" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override void BeginCalculation(SummaryResult summaryResult)
{
   _currentTopSalesAmount = 0;
   _currentTopSalesPerson = string.Empty;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next, implement the CanProcessDataType to tell the calculator to only calculate for numeric types:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:4007e3c5-b4b3-485f-bc07-568b8d2bcdd9" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override bool CanProcessDataType(Type dataType)
{
   return Utilities.IsNumericType(dataType);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The next part deals with the core part of our custom business logic in the aggregate method. The aggregate method essentially loops over every record in the xamDataGrid and gives you access to that Record as well as to the value in the current calculating column for that particular record. For our sample, we&amp;rsquo;re going to keep tabs on the current sales leader in a given category and as we find a leader update our string with that person&amp;rsquo;s name.&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:1895961d-5586-4b62-90b4-077fb2d80631" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override void Aggregate(object dataValue, SummaryResult summaryResult, 
  Record record)
{
  double myCellValue = double.Parse(dataValue.ToString());
  DataRecord myCurrentRecord = record as DataRecord;

  if (myCellValue  &amp;gt; _currentTopSalesAmount)
  {
     _currentTopSalesAmount = myCellValue;
     _currentTopSalesPerson = 
      myCurrentRecord.Cells[&amp;quot;FirstName&amp;quot;].Value.ToString() + &amp;quot; &amp;quot; +   
      myCurrentRecord.Cells[&amp;quot;LastName&amp;quot;].Value.ToString();
    }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After we&amp;rsquo;ve implemented this method, we only have a couple of steps in our calculation class to go. The first one, is to return the Winning Sales Persons name. The second is to name our custom calculation function and give it a description. The name is what will display in the dropdown box at run-time in the datagrid.&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:98937f1f-e45b-49e7-b32c-f555fc7dbccf" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;public override object EndCalculation(SummaryResult summaryResult)
{
   return _currentTopSalesPerson;
}

public override string Name
{
   get { return &amp;quot;Sales Leader&amp;quot;; }
}

public override string Description
{
    get { return &amp;quot;Top Sales Person&amp;quot;; }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Link the Custom Summary to the Application&lt;/h4&gt;
&lt;p&gt;Almost finished, now we can assign our new custom summary to our application by inserting it into our window_loaded method:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:d480a253-e5ea-42c8-95d7-13afb99e3a44" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;private void Window_Loaded(object sender, RoutedEventArgs e)
{
   TopSalesPerson Summary = new TopSalesPerson();
   SummaryCalculator.Register(Summary);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Lastly, the developer may want to show their custom summary on a specific field without placing it on every column. For instance, we may have a Quota column and a Sales column; the end-user would expect to see who the top sales person was, but maybe not who had the highest quota. This can be achieved by not registering our summary like demonstrated above, but by associating a specific summary definition with a given column:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:7dc2a76c-ac78-46cb-9558-8588606d1038" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;TopSalesPerson Summary = new TopSalesPerson();
     
SummaryDefinition myTopSalesPersonFormula = new SummaryDefinition();
myTopSalesPersonFormula.SourceFieldName = &amp;quot;SalesYTD&amp;quot;;
myTopSalesPersonFormula.Calculator = Summary;
this.xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Add(myTopSalesPersonFormula);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;In closing, the summary capabilities of the DataPresenter off ease of use in the pre-built commonly used formulas and flexibility in the ability to quickly add custom formulas to the DataGrid.&lt;/p&gt;
&lt;p&gt;&lt;img width="570" src="http://download.infragistics.com/community/andrewf/images/CustomSummary.png" height="400" alt="" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Aggregation&lt;/div&gt;
</description></item><item><title>Enabling Row Summaries in the XamDataGrid</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/10/enabling-row-summaries-in-the-xamdatagrid</link><pubDate>Sat, 28 Feb 2009 10:59:53 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:95f23878-6958-4629-81f8-39841e29d201</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 10:59:53 AM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Row Summaries or Row Aggregation is a feature that is enabled on the XamDataGrid quickly and easily by setting a couple of properties. The first property that needs to be set is the &amp;ldquo;AllowSummaries.&amp;rdquo; This property is off of the FieldSettings Object. By setting this property to true; the end user is now able to have a drop down button that shows a collection of standard summaries. (This is customizable and your own custom calculation could be added.)&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:ca36bcd8-79c4-4970-ba6c-e8b103976ff6" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igDP:XamDataGrid x:Name=&amp;quot;xamDataGrid1&amp;quot; DataSource=&amp;quot;{Binding}&amp;quot;&amp;gt;
  &amp;lt;igDP:XamDataGrid.FieldLayouts&amp;gt;
    &amp;lt;igDP:FieldLayout&amp;gt;
      &amp;lt;igDP:FieldLayout.FieldSettings&amp;gt;
        &amp;lt;igDP:FieldSettings AllowSummaries=&amp;quot;True&amp;quot; SummaryUIType=&amp;quot;Default&amp;quot; /&amp;gt;    
      &amp;lt;/igDP:FieldLayout.FieldSettings&amp;gt; 
    &amp;lt;/igDP:FieldLayout&amp;gt;
  &amp;lt;/igDP:XamDataGrid.FieldLayouts&amp;gt;
&amp;lt;/igDP:XamDataGrid&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The next property of importance to the row summary capabilities is the SummaryUIType property. This property defines whether the end-user is able to select a single calculation or multiple (e.g. Count and Sum or only Count). The enumeration for this property has five values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-Select &amp;ndash; User can select multiple calculations for all columns &lt;/li&gt;
&lt;li&gt;Multi-Select for Numerics Only &amp;ndash; User can select multiple calculations and no calculations on non-numeric based columns &lt;/li&gt;
&lt;li&gt;Single-Select &amp;ndash; User can only select a single calculation at a given time. &lt;/li&gt;
&lt;li&gt;Single-Select for Numerics Only &amp;ndash; User can only select a single calculation at a given time and no calculations on non-numeric based columns. &lt;/li&gt;
&lt;li&gt;Default &amp;ndash; Multi-Select for Numerics Only &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The last core property for Row Summaries in the XamDataGrid is the SummaryDisplayArea property. This, like the name implies, controls how and where summaries are displayed. The enum for this property contains eight possibilities:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;None &amp;ndash; Summary is hidden &lt;/li&gt;
&lt;li&gt;Top &amp;ndash; Summary is displayed at the top of the XamDataGrid &lt;/li&gt;
&lt;li&gt;TopFixed &amp;ndash; Summary is displayed at the top of the XamDataGrid and does not move when the grid is scrolled. &lt;/li&gt;
&lt;li&gt;Bottom &amp;ndash; Summary is displayed at the bottom of the XamDataGrid &lt;/li&gt;
&lt;li&gt;BottomFixed &amp;ndash; Summary is displayed at the bottom of the XamDataGrid and stays in view when the grid is scrolled &lt;/li&gt;
&lt;li&gt;TopLevelOnly &amp;ndash; This option effects a group-by display scenario and will only show records for the top level record collection (By default summary records are displayed at all levels.) &lt;/li&gt;
&lt;li&gt;DataRecordsOnly &amp;ndash; Summary records are displayed for DataRecordsOnly. When the XamDataGrid is in groupby mode, the summary records are not displayed. &lt;/li&gt;
&lt;li&gt;InGroupByRecords &amp;ndash; Summaries are displayed in each of the group-by records. &lt;/li&gt;
&lt;li&gt;Default &amp;ndash; TopLevelOnly and InGroupByRecords &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Lastly, all of the above properties can be set procedurally as follows:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:b4c9d20c-7bae-4551-bf37-98596a4820f0" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;using Infragistics.Windows.DataPresenter;
...
this.xamDataGrid1.FieldSettings.AllowSummaries = true;
this.xamDataGrid1.FieldSettings.SummaryUIType = SummaryUIType.MultiSelect;
this.xamDataGrid1.FieldSettings.SummaryDisplayArea =     
    SummaryDisplayAreas.InGroupByRecords | SummaryDisplayAreas.BottomFixed;
...
&lt;/pre&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Aggregation&lt;/div&gt;
</description></item><item><title>Exporting the XamDataGrid to Excel</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/9/exporting-the-xamdatagrid-to-excel</link><pubDate>Sat, 28 Feb 2009 10:55:09 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:b7c0481e-e478-43ed-90a8-287ba4661b1c</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 10:55:09 AM&lt;br /&gt;
&lt;p&gt;Infragistics.Excel is an extremely powerful, yet little known API. It has the capability to build an entire Excel Workbook (and multiple worksheets). You can add formulas and interact with an Excel document in C# code in many different fashions. On the roadmap for Infragistics WPF is to add support for a single method call to export the XamDataGrid to Excel; in the meantime, this code library gives you the basic functionality in a single class that you can easily re-use to achieve the exporting work.&lt;/p&gt;
&lt;p&gt;Basically, the class loops through RecordsCollection (also checks for records in the GroupByRecordsCollection) and creates a Infragistics.Excel.WorkSheetRow for each record.&lt;/p&gt;
&lt;p&gt;To consume this class, simply new up the exporter class and call the export method:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:8c273618-906d-4e12-9de2-93badfd6f295" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="c#"&gt;xamDataGridExcelExporter.xamDataGridExcelExporter xamDataGridExcelExporter1 =    
   new xamDataGridExcelExporter.xamDataGridExcelExporter();
xamDataGridExcelExporter1.Export(this.xamDataGrid1,
   @&amp;quot;C:\Excel\ExportFile.xls&amp;quot;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You can find the sample code &lt;a href="http://download.infragistics.com/community/wpf/articles/xamDataGridExcelExporter1.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="http://download.infragistics.com/community/wpf/articles/ExcelExport.png" style="max-width:550px;" alt="" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamDataGrid, Excel&lt;/div&gt;
</description></item><item><title>Configuring the XamTab Control</title><link>https://www.infragistics.com/community/product_platforms/wpf/w/wpf-wiki/7/configuring-the-xamtab-control</link><pubDate>Sat, 28 Feb 2009 10:51:37 GMT</pubDate><guid isPermaLink="false">7a8b7c76-b7ad-48e0-9694-5b04ca132ed0:deb8b264-7868-45f1-9e43-95ba726b2cac</guid><dc:creator>[Infragistics] Andrew Flick</dc:creator><description>Current Revision posted to WPF by [Infragistics] Andrew Flick on 2/28/2009 10:51:37 AM&lt;br /&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The XamTab Control was a control that was written in part to support the development of the XamRibbon. It supports a few additional features that will make it easy for a developer to create a familiar tabbed experience. &lt;/p&gt;
&lt;h3&gt;&lt;br /&gt;Setting up the Tab Control&lt;/h3&gt;
&lt;p&gt;To start, the developer should add the Infragistics3.Wpf dll to their project (or just drag the tab onto the design surface). The basic tab definition in xaml should look something like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:29504e2b-a0f7-4cda-a1aa-fe36535957d5" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;Window x:Class=&amp;quot;XamCommunitySample.MainWindow1&amp;quot;  
    xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;  
    xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;  
    Title=&amp;quot;Main Window Sample&amp;quot; Height=&amp;quot;600&amp;quot; Width=&amp;quot;800&amp;quot;  
        &amp;hellip;   
        xmlns:igWindows=&amp;quot;http://infragistics.com/Windows&amp;quot;  
         &amp;hellip;   
&amp;gt;  
&amp;hellip;   
  &amp;lt;igWindows:XamTabControl x:Name=&amp;quot;xamTab1&amp;quot; Theme=&amp;quot;Office2k7Blue&amp;quot;&amp;gt;  
     &amp;lt;igWindows:TabItemEx Header=&amp;quot;Tab1&amp;quot;&amp;gt;  
         &amp;lt;!--Content--&amp;gt;  
     &amp;lt;/igWindows:TabItemEx&amp;gt;  
     &amp;lt;igWindows:TabItemEx Header=&amp;quot;Tab2&amp;quot;&amp;gt;  
         &amp;lt;!--Content--&amp;gt;  
     &amp;lt;/igWindows:TabItemEx&amp;gt;  
  &amp;lt;/igWindows:XamTabControl&amp;gt;  
&amp;hellip;   
&amp;lt;/Window&amp;gt;  &lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;&lt;br /&gt;Customizing the Tab Control&lt;/h3&gt;
&lt;p&gt;Then you have the ability to customize the layout of the tab control; where tabs are placed, if they scroll, or are stacked, and the ability to close them. &lt;/p&gt;
&lt;p&gt;To control where Tabs are placed you are given the option of positioning tabs on the top, left, bottom, or right of the content by setting the TabStripPlacement Property. You can also determine how the tabs are displayed in each of these locations by setting the TabLayoutStyle property to one of the following: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MultiRowAutoSize &amp;ndash; Allows for multiple rows of tabs and sized based on their content &lt;/li&gt;
&lt;li&gt;MultiRowSizeToFit &amp;ndash; Allows for multiple rows of tabs and sized based on their content and then allowed to grow in size if more room to display the items is available. &lt;/li&gt;
&lt;li&gt;SingleRowAutoSize &amp;ndash; Allows for a single row of tab that is sized based on the size of the content. &lt;/li&gt;
&lt;li&gt;SingleRowJustified &amp;ndash; Allows for a single row of tabs that is sized first based on their content and then reduced in size if there is not enough room to fit the items. &lt;/li&gt;
&lt;li&gt;SingleRowSizeToFit &amp;ndash; Allows for a single row of tabs that is sized based on their content and then allowed to grow in size if more room to display the items is available. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To give the tab the ability to close, simply set the TabItemCloseButtonVisibility property. This property takes one of four different self-descriptive settings: hidden, visible, WhenSelected, and WhenSelectedOrHotTracked. All of the above settings can be set off the base Tab control like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:41824ced-f955-4df9-90a7-646ed6c51b1a" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igWindows:XamTabControl x:Name=&amp;quot;xamTab1&amp;quot; Theme=&amp;quot;Office2k7Blue&amp;quot;    
           TabStripPlacement=&amp;quot;Top&amp;quot; TabLayoutStyle=&amp;quot;SingleRowSizeToFit&amp;quot;    
           TabItemCloseButtonVisibility=&amp;quot;WhenSelectedOrHotTracked&amp;quot;&amp;gt; &lt;/pre&gt;
&lt;p&gt;Lastly, another interesting feature about the tab control is the ability to have some sort of content injected in front of or following the tabs. This is useful for adding your own custom buttons or items that should span across multiple tabs. To do this simply insert some sort of content into either the PreTabItemContent or the PostTabItemContent like this:&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:e3617d40-473c-42ff-827c-e1e0ecdeea05" class="wlWriterEditableSmartContent"&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;igWindows:XamTabControl.PostTabItemContent&amp;gt;  
  &amp;lt;StackPanel Orientation=&amp;quot;Horizontal&amp;quot;&amp;gt;  
     &amp;lt;Button Margin=&amp;quot;0,0,0,0&amp;quot; Click=&amp;quot;Button_Click&amp;quot;&amp;gt;Print Content&amp;lt;/Button&amp;gt;  
  &amp;lt;/StackPanel&amp;gt;  
&amp;lt;/igWindows:XamTabControl.PostTabItemContent&amp;gt;  &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp; &lt;br /&gt;The tab control with its additional styling capability by setting the theme property definitely gives you the ability to easily create the tabbed browsing experience popular in many current Windows Client application.&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: WPF, XamTab&lt;/div&gt;
</description></item></channel></rss>