Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
755
FieldLayout from DataBase / string
posted

Hi

I want some kind of plugin mechanism for the fieldlayout of my grids.

are there any methods in infragistics to set the fieldlayout from string?

forexample when I have a string like this

 <igDataPresenter:FieldLayout >
 <igDataPresenter:Field Name="MyField" Label="Name"/>
</igDataPresenter:FieldLayout>

is there a way to set this as current fieldlayout ? 
Any hints / advice?
  • 34510
    Offline posted

    Hi Haggy,

    You can create a FieldLayout from that string in code-behind but there's no way to use that string directly with the XamDataGrid to tell it to use that layout.  You can use the XamlReader class to convert that string into an actual FieldLayout object and then add it to the grid.  An example on how to use XamlReader can be seen here. 

    StringReader sr = new StringReader(@"<igDP:FieldLayout xmlns:igDP='http://infragistics.com/DataPresenter'>
    <igDP:Field Name='MyField' Label='Name'/>
    </igDP:FieldLayout>");
    
    XmlReader reader = XmlReader.Create(sr);
    FieldLayout dynamicFieldLayout = (FieldLayout)XamlReader.Load(reader);

     

    Let me know if you have any questions on this.