private void SaveLayout()
{
dockingManager1.SaveXML(fileName);
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("SerializedControlCollection");
doc.AppendChild(root);
//go through the sites
foreach (IDockingSite site in dockingManager1.DockingSites)
{
//now get panels
foreach (DockPanel pan in site.ManagedDockables)
{
//check if there is anything in panel
if (pan.Controls.Count > 0)
{
//get first child of panel, this one is interesting for me
UserControl userControl = pan.Controls[0] as UserControl;
//check if this is user control
if (userControl != null)
{
XmlElement contElement = doc.CreateElement("Control");
XmlAttribute att = doc.CreateAttribute("DockableGuid");
contElement.Attributes.Append(att);
att.InnerText = pan.ID.ToString();
contElement.InnerText = userControl.GetType().FullName;
root.AppendChild(contElement);
}
}
}
}
doc.Save(controlFile);
}
private void RestoreLayout()
{
if (File.Exists(fileName))
{
dockingManager1.LoadXML(fileName);
}
XmlDataDocument controlInfo = new XmlDataDocument();
controlInfo.Load(controlFile);
//create hashtable to make it easier later
Dictionary<string, string> idToTypeMap=new Dictionary<string, string>();
foreach (XmlElement el in controlInfo.FirstChild.ChildNodes)
{
string guid = el.GetAttribute("DockableGuid");
idToTypeMap[guid] = el.InnerText;
}
//restore contorls inside
foreach (IDockingSite site in dockingManager1.DockingSites)
{
//now get panels
foreach (DockPanel pan in site.ManagedDockables)
{
if(idToTypeMap.ContainsKey(pan.ID.ToString()))
{
string typeName = idToTypeMap[pan.ID.ToString()];
Type t = this.GetType().Assembly.GetType(typeName);
Control con = (Control) Activator.CreateInstance(t);
pan.Controls.Add(con);
}
}
}
}
Hi.
I get problems with conditional formatting.
In the case that you want to set font color (CellForeColor) that depending on the column condition and you set property ‘Apply to row’ is true and also if you create second condition that changing row back color you will lose CellForeColor setup from first condition.
Is it possible to change dynamically “row back color” without using conditional formatting?
private void WebHRSnifferForm_Load(object sender, EventArgs e)
{
dataBind104ComSettingGrid();
}
private void dataBind104ComSettingGrid()
{
// QueryStringParams is type of KeyValueConfigurationCollection
Grid104CompSetting.DataSource = webHRConfig.OneZeroFour.Company.QueryStringParams.GetEnumerator();
}
But it seems the girdview cannot locate the properties exposed by KeyValueConfigurationElement that is contained within KeyValueConfigurationCollection. So no columns are created.
Is there anything I should implement to let gridview bind to KeyValueConfigurationCollection.
Thanks a lot.
Ricky.