in Education by
I have a custom class (NewBlockLabelInfo) with an observable collection of another custom class (DoorControllerLabelInfo) I've successfully databound the NewBlockLabelInfo class to the treeview, and everything displays fine. I have a lot of textboxs that are data bound to certain properties, and updating these reflects in the treeview. I'd like to databind one set of textboxs for the properties, to the selected item in the treeview IF the selected item is a child of the specified treeviewitem (Observable Collection, Door Controllers) The Data Context is specified at the window level. I've looked long and hard for a way to do this, let alone the best way. Heres the WPF XAML for the TreeView How can I bind a textbox to a selected item property (or to the databound class property) of a TreeViewItem only if it is a child of Door Controllers TreeViewItem Thank you in advance Oliver JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You would likely be best served with defining a DataTemplate selector, and creating several datatemplates. The selector can evaluate all kinds of logical rules, and return the template that you want. Here is a pretty good getting started tutorial on DataTemplateSelectors. EDIT After rereading your question here is what I have got. Do your model classes have navigation properties to get to parent objects? If so, you can use triggers (or more preferable if you are using MVVM) properties on the ViewModel to enable/disable/alter visibility based on what the parent object is rather than the parent TreeViewItem. It is a bit more difficult to access the visual tree the way you are describing.

Related questions

0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    I have a split screen design. I'd like to access the folder ID from the parent route only when ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 30, 2022 in Education by JackTerrance
0 votes
0 votes
    I am using Android Data Binding framework I have suppose an EditText for login form with username as below ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    Is there a way, for the FlipView control, to ONLY have it load the selected item?? The default ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    Is there a way, for the FlipView control, to ONLY have it load the selected item?? The default ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 5, 2022 in Education by JackTerrance
0 votes
0 votes
    Three squares of Chess board are selected at random. Find the probability of getting 2 squares of one colour ... a different colour. Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
0 votes
    When candidates have only the condition of age, why should they give other information to Election Commission? Please answer the above question....
asked Aug 14, 2022 in Education by JackTerrance
...