Hello friend, I want to print tree structure showing in WPF treeview control in multiple page. I tried PrintVisual() but it only prints only visible parts. Then I tried FlowDocument and written AddNode(), but its not showing the same result as treeview doimg. Please help me with code.
public void AddNodes(int uid, ListItem tSubNode)
{
string query = "select fullname, id from members where refCode=" + uid + ";";
String memValue;
MySqlCommand cmd = new MySqlCommand(query, db.conn);
MySqlDataAdapter _DA = new MySqlDataAdapter(cmd);
DataTable _DT = new DataTable();
_DA.Fill(_DT);
ListOffset += 20;
foreach (DataRow _dr in _DT.Rows)
{
ListItem tNode = new ListItem();
tNode.Margin = new Thickness(ListOffset,0,0,0);
memValue = _dr["fullname"].ToString() + " (" + _dr["id"].ToString() + ")";
tNode.Blocks.Add(new Paragraph(new Run(hyp+memValue)));
myList.ListItems.Add(tNode);
flowDoc.Blocks.Add(myList);
_fdrMembers.Document = flowDoc;
if (db.HasMembers(Convert.ToInt32(_dr["id"].ToString())))
{
AddNodes(Convert.ToInt32(_dr["id"]), tNode);
}
}
ListOffset = 20;
}
private void button_Click(object sender, RoutedEventArgs e)
{
ListOffset = 0;
myList.ListItems.Clear();
tSuper.Blocks.Clear();
if (db.GetNameByUID(100001) != null)
{
tSuper.Blocks.Add(new Paragraph(new Run(db.GetNameByUID(100001))));
myList.ListItems.Add(tSuper);
AddNodes(100001, tSuper);
}
MessageBox.Show("Member by ID - "+does.ToString()+", "+dosnt.ToString(), "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
}**strong text**