Listbox
-
I want to host controls within a ListBoxItem (ListBox control).Code XAML:
< ListBoxItem Background="LightBlue"
Foreground="Blue" FontFamily="Verdana" FontSize="12" FontWeight="Bold">
< CheckBox Name="IcedTeaCheckBox">
< Image Source="temp.jpg" Height="30">
< TextBlock Text="Iced Tea">< /TextBlock>But i want to solve that by Coded-Behind. :-O sorry for my english. Thank :-O
-
I want to host controls within a ListBoxItem (ListBox control).Code XAML:
< ListBoxItem Background="LightBlue"
Foreground="Blue" FontFamily="Verdana" FontSize="12" FontWeight="Bold">
< CheckBox Name="IcedTeaCheckBox">
< Image Source="temp.jpg" Height="30">
< TextBlock Text="Iced Tea">< /TextBlock>But i want to solve that by Coded-Behind. :-O sorry for my english. Thank :-O
You want to add the controls in your code behind instead, or you want to access them there ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
You want to add the controls in your code behind instead, or you want to access them there ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
The listboxitem has AddChild and AddVisualChild methods. It also has a GetVisualChild method for getting back child elements. I'd say that's the way to go.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
The listboxitem has AddChild and AddVisualChild methods. It also has a GetVisualChild method for getting back child elements. I'd say that's the way to go.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Not really, no. The methods are, IMO, self documenting. I've never done what you want to do, I just took the time to google it for you.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Not really, no. The methods are, IMO, self documenting. I've never done what you want to do, I just took the time to google it for you.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I want to host controls within a ListBoxItem (ListBox control).Code XAML:
< ListBoxItem Background="LightBlue"
Foreground="Blue" FontFamily="Verdana" FontSize="12" FontWeight="Bold">
< CheckBox Name="IcedTeaCheckBox">
< Image Source="temp.jpg" Height="30">
< TextBlock Text="Iced Tea">< /TextBlock>But i want to solve that by Coded-Behind. :-O sorry for my english. Thank :-O
What are you having trouble with? If you want to create controls from code, just create control objects and set properties on those objects. e.g.
//< ListBoxItem removed="LightBlue" //Foreground="Blue" FontFamily="Verdana" FontSize="12" FontWeight="Bold"> // < CheckBox Name="IcedTeaCheckBox"> // "Horizontal"> // < Image Source="temp.jpg" Height="30"></Image> // < TextBlock Text="Iced Tea">< /TextBlock> ListBoxItem item = new ListBoxItem(); item.Foreground = new SolidColorBrush(Colors.Blue); item.FontSize = 12; item.FontWeight = FontWeights.Bold; CheckBox cb = new CheckBox(); cb.Name = "IcedTeaCheckBox"; //etc.... item.Content = cb;
Mark Salsbery Microsoft MVP - Visual C++ :java: