In C#, when I attempt to set TileLayoutOrder, I get an Object reference not set to an instance of an object error message. I do this in either Window_Initialized or MainTiles_Initialized (MainTiles is the name of my xamTilesControl) and I get the error.
However if I do it in Window_Loaded or MainTiles_Loaded, I don't get the error, but the value never applies. The only way I can get this to work is by setting in the xaml file, but I want it in C#.
How do I do this? I am following the documented example, and, nonetheless, I am getting an error.
Thanks,
Mike
Hello Mike,
I am very glad that my suggestion was helpful for you. Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Krasimir,
Thanks for your answer, it helps me get a deeper understanding of the control and sets me on the path to being able to get it to do what I need it to.
Thank you.
Mike Malter
I have been looking into the issue that you have described and it seems that the reason for the exception that you are getting is that the NormalModeSettings object is null in the Initialized event of the XamTilesControl. You can use the following code line in order to set the TileLayoutOrder through the Initialized event:
private void xamTilesControl1_Initialized(object sender, EventArgs e) { xamTilesControl1.NormalModeSettings = new Infragistics.Windows.Tiles.NormalModeSettings { TileLayoutOrder = Infragistics.Windows.Tiles.TileLayoutOrder.Horizontal }; }
I have created a sample application that shows the described approach.
If you need any further assistance please do not hesitate to ask.