Click here to Skip to main content
15,917,709 members
Home / Discussions / WPF
   

WPF

 
QuestionStop Multiple storyboards Pin
wlxl8-Jan-11 5:43
wlxl8-Jan-11 5:43 
AnswerRe: Stop Multiple storyboards Pin
Abhinav S8-Jan-11 20:59
Abhinav S8-Jan-11 20:59 
QuestionWPF, ASP.NET, Silverlight SSO Pin
javawizard@gmail.com7-Jan-11 6:09
javawizard@gmail.com7-Jan-11 6:09 
AnswerRe: WPF, ASP.NET, Silverlight SSO Pin
#realJSOP8-Jan-11 0:34
professional#realJSOP8-Jan-11 0:34 
AnswerRe: WPF, ASP.NET, Silverlight SSO Pin
RichardGrimmer10-Jan-11 4:00
RichardGrimmer10-Jan-11 4:00 
QuestionNeed Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»6-Jan-11 7:09
professionalKunal Chowdhury «IN»6-Jan-11 7:09 
AnswerRe: Need Help: Is it possible to create such ComboBox UI? Pin
SledgeHammer016-Jan-11 16:17
SledgeHammer016-Jan-11 16:17 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»7-Jan-11 0:42
professionalKunal Chowdhury «IN»7-Jan-11 0:42 
AnswerRe: Need Help: Is it possible to create such ComboBox UI? Pin
Abhinav S7-Jan-11 16:47
Abhinav S7-Jan-11 16:47 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»7-Jan-11 17:11
professionalKunal Chowdhury «IN»7-Jan-11 17:11 
AnswerRe: Need Help: Is it possible to create such ComboBox UI? Pin
Abhinav S7-Jan-11 17:20
Abhinav S7-Jan-11 17:20 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»7-Jan-11 17:26
professionalKunal Chowdhury «IN»7-Jan-11 17:26 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Abhinav S7-Jan-11 17:40
Abhinav S7-Jan-11 17:40 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»7-Jan-11 17:45
professionalKunal Chowdhury «IN»7-Jan-11 17:45 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
SledgeHammer017-Jan-11 17:55
SledgeHammer017-Jan-11 17:55 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»9-Jan-11 3:45
professionalKunal Chowdhury «IN»9-Jan-11 3:45 
GeneralRe: Need Help: Is it possible to create such ComboBox UI? Pin
Kunal Chowdhury «IN»10-Jan-11 1:26
professionalKunal Chowdhury «IN»10-Jan-11 1:26 
QuestionTreeViewItem Binding Doubt Pin
AmitDey6-Jan-11 6:51
AmitDey6-Jan-11 6:51 
AnswerRe: TreeViewItem Binding Doubt Pin
SledgeHammer016-Jan-11 8:14
SledgeHammer016-Jan-11 8:14 
GeneralRe: TreeViewItem Binding Doubt Pin
AmitDey7-Jan-11 6:17
AmitDey7-Jan-11 6:17 
GeneralRe: TreeViewItem Binding Doubt Pin
SledgeHammer017-Jan-11 7:55
SledgeHammer017-Jan-11 7:55 
AnswerRe: TreeViewItem Binding Doubt Pin
Ian Shlasko7-Jan-11 9:03
Ian Shlasko7-Jan-11 9:03 
I think you're going about this the wrong way... Yes, you can work directly with the TreeView, but that's not how it's supposed to be used. The idea is to do everything via data-binding, so you never have to touch the TreeView or TreeViewItems at all.

Here's how I would go about this:

1) Add a "Children" property to your Item (Can call it whatever you want), typed as, say, an ObservableCollection<Item>. You may also want to create boolean properties such as "IsExpanded" and "IsSelected", which can be bound in the TreeView.ItemContainerStyle.

2) As another poster suggested, implement INotifyPropertyChanged on your Item class, and make sure you're raising the PropertyChanged event when the Text property changes.

3) Use a HierarchicalDataTemplate in your XAML... This is basically a DataTemplate that also has an ItemsSource property to include children... Something simple, like:
XAML
<HierarchicalDataTemplate DataType="{x:Type local:Item}" ItemsSource="{Binding Children}">
	<TextBox Text="{Binding Text}"/>
</HierarchicalDataTemplate>

(You can expand on it later)

4) Set the ItemsSource property of your TreeView to the root node of your tree. It'll automatically generate the rest of the nodes as you modify your Item and its children.

Now, when you want to add another node under your root, just pop one into the Children collection, and the TreeView will detect this and update itself. Basically, you should never have to touch the TreeViewItems directly.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

Questionsilverlight 4- which rows are updated with checkbox. [modified] Pin
arkiboys5-Jan-11 22:59
arkiboys5-Jan-11 22:59 
AnswerRe: silverlight 4- which rows are updated with checkbox. Pin
Pete O'Hanlon5-Jan-11 23:38
mvePete O'Hanlon5-Jan-11 23:38 
GeneralRe: silverlight 4- which rows are updated with checkbox. Pin
arkiboys5-Jan-11 23:43
arkiboys5-Jan-11 23:43 

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.