Click here to Skip to main content
15,888,579 members
Home / Discussions / WPF
   

WPF

 
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 
My TreeView has an associated Item Template
I am trying to add a TreeViewItem tvi to a TreeView by code.
And I am bounding tvi to an instance of class Item
But the Item.Text is not reflected in TreeViewItem Text
What is the reason for this.
Here is the code
DataTemplate
<DataTemplate x:Key="TreeViewHeaderReadTemplate">
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Text}" />
    </StackPanel>
</DataTemplate>

TreeView
<sdk:TreeView Name="TreeView" ItemTemplate="{StaticResource TreeViewHeaderReadTemplate}">
</sdk:TreeView>

Class Item
public class Item
{
    public Item(string text)
    {
        Text = text;
    }
    public string Text { get; set; }
}

Code to add TreeViewItem to TreeView
TreeViewItem tvi = new TreeViewItem();
Item item = new Item("Caption");  
Tvi.DataContext = item;                     
TreeView.Items.Add(item);


I am not able to bind “caption” as the text for the treeviewitem.

The following code works for me
TreeView.Items.Add(new Item(“Caption”));

But I specifically need to add a TreeViewItem control and not a Item object
And I need this TreeViewItem to be bound to Item because I need that “Text” property bound.

What am I missing out here ?
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 
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 
QuestionParent, Child & GrandChild binding in WPF & Silverlight Pin
Chazzysb5-Jan-11 4:33
Chazzysb5-Jan-11 4:33 
AnswerRe: Parent, Child & GrandChild binding in WPF & Silverlight Pin
Abhinav S6-Jan-11 1:08
Abhinav S6-Jan-11 1:08 
GeneralRe: Parent, Child & GrandChild binding in WPF & Silverlight Pin
Chazzysb6-Jan-11 3:55
Chazzysb6-Jan-11 3:55 
QuestionHow can I create layout in the following way? Pin
Pankaj Nikam4-Jan-11 23:36
professionalPankaj Nikam4-Jan-11 23:36 
AnswerRe: How can I create layout in the following way? Pin
#realJSOP6-Jan-11 2:16
mve#realJSOP6-Jan-11 2:16 
GeneralRe: How can I create layout in the following way? Pin
mbcrump12-Jan-11 4:34
mentormbcrump12-Jan-11 4:34 
QuestionValidation for Duplication of Data by using Identifier name Pin
Rocky234-Jan-11 22:42
Rocky234-Jan-11 22:42 
AnswerRe: Validation for Duplication of Data by using Identifier name Pin
Pete O'Hanlon4-Jan-11 23:34
mvePete O'Hanlon4-Jan-11 23:34 
GeneralRe: Validation for Duplication of Data by using Identifier name Pin
Rocky234-Jan-11 23:49
Rocky234-Jan-11 23:49 
GeneralRe: Validation for Duplication of Data by using Identifier name Pin
Pete O'Hanlon5-Jan-11 0:41
mvePete O'Hanlon5-Jan-11 0:41 

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.