European Silverlight 4 & Silverlight 5 Hosting BLOG

BLOG about Silverlight 5 Hosting and Its Techologies - Dedicated to European Windows Hosting Customer

Silverlight 5 Hosting Germany - HostForLIFE.eu :: How to access controls in DataGrid TemplateColumn header?

clock June 12, 2014 08:36 by author Peter

A data grid view is a rectangular control made of columns and rows. I have a DataGrid where I have included some controls in column header. Each column is a Template column. These controls appear just below the column header which are used for entering filter information. Here's the issue on my code on Silverlight 5.

VisualTreeHelper class helps to iterate through the visual tree of the xaml. Using it we can find the child and parent controls of the rendered controls. Lets check the Visual Tree of the rendered control using Silverlight Spy.

The Following Method do a search over the child controls with in a control recursively and returns the control based on Name.

private object GetChildControl(DependencyObject parent, string controlName)


    Object tempObj = null;
    int count = VisualTreeHelper.GetChildrenCount(parent);
    for (int counter = 0; counter < count; counter++)
    {
        //Get The Child Control based on Index
        tempObj = VisualTreeHelper.GetChild(parent, counter);
        //If Control's name Property matches with the argument control
        //name supplied then Return Control
        if ((tempObj as DependencyObject).GetValue(NameProperty).ToString() == controlName)
            return tempObj;
        else //Else Search Recursively
        {
            tempObj = GetChildControl(tempObj as DependencyObject, controlName);
            if (tempObj != null)
                return tempObj;
        }
    }
    return null;
}

Make sure that the same has to be delegated to UI thread using Dispatcher.As the controls created using UI Thread can not be accessed from other thread.
//Access the Grid Header Controls
Dispatcher.BeginInvoke(delegate
{
    var hyperlinkControl = GetChildControl(dataGrid1, "hlSort");
    var checkControl = GetChildControl(dataGrid1, "chkSelectAll");
});



Silverlight 5 Hosting Germany - HostForLIFE.eu :: How to access controls in DataGrid TemplateColumn header?

clock June 12, 2014 08:36 by author Peter

A data grid view is a rectangular control made of columns and rows. I have a DataGrid where I have included some controls in column header. Each column is a Template column. These controls appear just below the column header which are used for entering filter information. Here's the issue on my code on Silverlight 5.

VisualTreeHelper class helps to iterate through the visual tree of the xaml. Using it we can find the child and parent controls of the rendered controls. Lets check the Visual Tree of the rendered control using Silverlight Spy.

The Following Method do a search over the child controls with in a control recursively and returns the control based on Name.

private object GetChildControl(DependencyObject parent, string controlName)

    Object tempObj = null;
    int count = VisualTreeHelper.GetChildrenCount(parent);
    for (int counter = 0; counter < count; counter++)
    {
        //Get The Child Control based on Index
        tempObj = VisualTreeHelper.GetChild(parent, counter);
        //If Control's name Property matches with the argument control
        //name supplied then Return Control
        if ((tempObj as DependencyObject).GetValue(NameProperty).ToString() == controlName)
            return tempObj;
        else //Else Search Recursively
        {
            tempObj = GetChildControl(tempObj as DependencyObject, controlName);
            if (tempObj != null)
                return tempObj;
        }
    }
    return null;
}

Make sure that the same has to be delegated to UI thread using Dispatcher. As the controls created using UI Thread can not be accessed from other thread.
//Access the Grid Header Controls
Dispatcher.BeginInvoke(delegate
{
    var hyperlinkControl = GetChildControl(dataGrid1, "hlSort");
    var checkControl = GetChildControl(dataGrid1, "chkSelectAll");
});



HostForLIFE.eu Announces Release of Cheap Dedicated Windows Cloud Server Hosting Plans

clock June 3, 2014 09:08 by author Peter

European leading web hosting provider, HostForLIFE.eu announced cheap dedicated Windows cloud server due to high demand of Windows cloud server users in Europe.

Windows & ASP.NET hosting provider HostForLIFE.eu announced cheap dedicated Windows cloud server hosting plans. HostForLIFE.eu offers the ultimate performance and flexibility at an economical price for windows cloud server. HostForLIFE.eu cheap dedicated Windows cloud server hosting plans starts from just as low as €16.00/month only.

HostForLIFE.eu provisions all dedicated Windows Cloud Server in just few minutes (upon payment verification and completion). HostForLIFE.eu has a very strong commitment to introduce their Cheap dedicated Windows and ASP.NET Cloud Server hosting service to the worldwide market. HostForLIFE.eu starts to target market in Europe. HostForLIFE.eu will be the one-stop cheap dedicated Windows and ASP.NET Cloud Server Hosting Solution for every ASP.NET enthusiast and developer.

HostForLIFE’s cheap dedicated Windows Dedicated Cloud Server hosting plan comes with the following features: Windows 2008R2/2012, Data Center OS Version, 1 x vCPU, 1 GB RAM, You have full root access to the server 24/7/365, 40 GB Storage (SSD), 1000 GB Bandwidth, 1000 Mbps Connection, 1 Static IP and SAN Storage.

For additional information on this cheap Windows dedicated cloud server Hosting plan, please visit http://hostforlife.eu/European-Cheap-Windows-Cloud-Server-Plans

About HostForLIFE.eu:
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see www.microsoft.com/web/hosting/HostingProvider/Details/953). Their service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, they have also won several awards from reputable organizations in the hosting industry and the detail can be found on their official website.



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in