Click here to Skip to main content
15,886,840 members
Home / Discussions / C#
   

C#

 
AnswerRe: Start a Service after install it ? Pin
Tamer Oz31-Aug-09 22:41
Tamer Oz31-Aug-09 22:41 
GeneralRe: Start a Service after install it ? Pin
Mohammad Dayyan1-Sep-09 0:46
Mohammad Dayyan1-Sep-09 0:46 
QuestionHow to stop code generator in designer in this case Pin
vql31-Aug-09 21:28
vql31-Aug-09 21:28 
QuestionHow to show a form from windows service? Pin
Tridip Bhattacharjee31-Aug-09 21:28
professionalTridip Bhattacharjee31-Aug-09 21:28 
AnswerRe: How to show a form from windows service? Pin
Vimalsoft(Pty) Ltd31-Aug-09 21:31
professionalVimalsoft(Pty) Ltd31-Aug-09 21:31 
AnswerRe: How to show a form from windows service? Pin
Hristo-Bojilov31-Aug-09 22:04
Hristo-Bojilov31-Aug-09 22:04 
AnswerRe: How to show a form from windows service? Pin
Tamer Oz31-Aug-09 22:05
Tamer Oz31-Aug-09 22:05 
QuestionCheck Box Click Event Pin
Saiyed Alam31-Aug-09 20:20
Saiyed Alam31-Aug-09 20:20 
Hello Friends
I have a TreeView which has many nodes which are are being created dynamically.
I have set a check box against each node of that TreeView. Now My Problem is I need to work with it's Click event. But how can I hold it.?
Here's The code where I do this.

private void BuildTree(List<ParentChild> liParentChild)
{
List<ParentChild> liParent = liParentChild.FindAll(delegate(ParentChild oParentChild) { return oParentChild.ParentID == 0; });
foreach (ParentChild currentParent in liParent)
{
TreeViewItem currentParentNode = new TreeViewItem();
currentParentNode.Tag = currentParent.ID;


string folderImagePath=@"C:\Documents and Settings\Sharif\My Documents\Visual Studio 2008\Projects\TreeView\TreeView\Images\FolderOne.jpg";
// string lowerLevelImagePath=@"C:\Documents and Settings\Sharif\My Documents\Visual Studio 2008\Projects\TreeView\TreeView\Images\FoldeTow.jpg";
string fileImagePath = @"C:\Documents and Settings\Sharif\My Documents\Visual Studio 2008\Projects\TreeView\TreeView\Images\File.jpg";

#region image and font style
StackPanel oStackPanel = new StackPanel();
oStackPanel.Orientation = Orientation.Horizontal;

CheckBox oCheckBox = new CheckBox();
oCheckBox.Name = "cb_" + currentParent.ID;
//oCheckBox.IsEnabled = false;


oStackPanel.Children.Add(oCheckBox);
oStackPanel.Children.Add(CreateIcon(folderImagePath));

TextBlock tb = new TextBlock();
tb.Text = currentParent.Name;
oStackPanel.Children.Add(tb);
currentParentNode.Header = oStackPanel;

#endregion

AddTreeChild(currentParentNode, liParentChild, currentParent,1,folderImagePath,fileImagePath);
tvParentChild.Items.Add(currentParentNode);
//ExpandAll(tvParentChild);
//CollapseAll(tvParentChild);



}
}


private void AddTreeChild(TreeViewItem currentParentNode,List<ParentChild> liPC,ParentChild currParent,int level,string folderImagePath,string fileImagePath)
{
int currntLevel = level + 1;
List<ParentChild> liChild = liPC.FindAll(delegate(ParentChild oParentChild) { return oParentChild.ParentID == currParent.ID; });

foreach (ParentChild currentChild in liChild)
{

TreeViewItem currentChildNode = new TreeViewItem();

StackPanel oStackPanel = new StackPanel();
oStackPanel.Orientation = Orientation.Horizontal;
currentChildNode.Tag = currentChild.ID;

#region font style and image

string sourcePath;

if(IsLeaf(currentChild.ID,liPC))
sourcePath = fileImagePath;
else
sourcePath = folderImagePath;

if (currntLevel % 2 == 0)
{

//currentChildNode.FontStyle = System.Windows.FontStyles.Italic;
currentChildNode.Foreground = Brushes.Brown;

//currentChildNode.Background = Brushes.White;

}
else
{
//currentChildNode.FontStyle = System.Windows.FontStyles.Normal;
currentChildNode.Foreground = Brushes.Black;
//currentChildNode.Background = Brushes.White;

}

CheckBox oCheckBox = new CheckBox();
oCheckBox.Name = "cb_" + currentChild.ID;
// oCheckBox.IsEnabled = false;
oStackPanel.Children.Add(oCheckBox);

oStackPanel.Children.Add(CreateIcon(sourcePath));

TextBlock tb = new TextBlock();
tb.Text = currentChild.Name;
oStackPanel.Children.Add(tb);
currentChildNode.Header = oStackPanel;
#endregion

AddTreeChild(currentChildNode, liPC, currentChild,currntLevel,folderImagePath,fileImagePath);
currentParentNode.Items.Add(currentChildNode);

}

}
AnswerRe: Check Box Click Event Pin
dan!sh 31-Aug-09 22:31
professional dan!sh 31-Aug-09 22:31 
Questioncreating word document using c# Pin
Swetha Srinivasan31-Aug-09 20:16
Swetha Srinivasan31-Aug-09 20:16 
AnswerRe: creating word document using c# Pin
Christian Graus31-Aug-09 20:36
protectorChristian Graus31-Aug-09 20:36 
GeneralRe: creating word document using c# Pin
Swetha Srinivasan31-Aug-09 23:20
Swetha Srinivasan31-Aug-09 23:20 
AnswerRe: creating word document using c# Pin
stancrm31-Aug-09 20:38
stancrm31-Aug-09 20:38 
QuestionWCF - HTTP Post The remote server returned an error: (400) Bad Request Pin
senthilkamal31-Aug-09 19:52
senthilkamal31-Aug-09 19:52 
AnswerRe: WCF - HTTP Post The remote server returned an error: (400) Bad Request Pin
Vimalsoft(Pty) Ltd31-Aug-09 21:32
professionalVimalsoft(Pty) Ltd31-Aug-09 21:32 
QuestionWebservices error Pin
sevag.m31-Aug-09 19:26
sevag.m31-Aug-09 19:26 
AnswerRe: Urgent need help :) Webservices Pin
Mycroft Holmes31-Aug-09 19:31
professionalMycroft Holmes31-Aug-09 19:31 
GeneralWebservices Pin
sevag.m31-Aug-09 20:27
sevag.m31-Aug-09 20:27 
Question[Message Deleted] Pin
Swetha Srinivasan31-Aug-09 18:34
Swetha Srinivasan31-Aug-09 18:34 
AnswerRe: Progress Bar in c# Pin
Christian Graus31-Aug-09 18:43
protectorChristian Graus31-Aug-09 18:43 
GeneralRe: Progress Bar in c# Pin
Swetha Srinivasan31-Aug-09 18:45
Swetha Srinivasan31-Aug-09 18:45 
GeneralRe: Progress Bar in c# Pin
Mycroft Holmes31-Aug-09 19:34
professionalMycroft Holmes31-Aug-09 19:34 
GeneralRe: Progress Bar in c# Pin
Swetha Srinivasan31-Aug-09 20:05
Swetha Srinivasan31-Aug-09 20:05 
General[Message Deleted] Pin
Swetha Srinivasan31-Aug-09 20:17
Swetha Srinivasan31-Aug-09 20:17 
GeneralRe: Progress Bar in c# Pin
Christian Graus31-Aug-09 20:37
protectorChristian Graus31-Aug-09 20:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.