473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I add items dynamically to a WrapPanel?

19
I have the following XAML:
Expand|Select|Wrap|Line Numbers
  1. <Window x:Class="ImageComparing.MainWindow"
  2.         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="350" Width="525" xmlns:my="clr-namespace:ImageComparing" Title="Image comparing">
  4.     <DockPanel>
  5.         <ToolBar Name="toolbar1" DockPanel.Dock="Top" Height="41" Background="#FFA5D95A">
  6.             other content
  7.         </ToolBar>
  8.         <WrapPanel Name="wrapPanel1" >
  9.             other content
  10.             <Label Content="Label" Height="28" Name="label1" />
  11.         </WrapPanel>
  12.     </DockPanel>
  13. </Window>
  14.  
I want to add content to wrapPanel1 - I tried the following code:
Expand|Select|Wrap|Line Numbers
  1.     if (info.Attributes == FileAttributes.Directory)
  2.         wrapPanel1.Children.Add(new FolderEntry(info.Name));
  3.     else
  4.         wrapPanel1.Children.Add(new FileEntry(info.Name));
  5.  
for some reason, the items don't show up. How can I fix that problem?
Jun 16 '14 #1
1 7469
Frinavale
9,735 Expert Mod 8TB
The items need to be WPF controls.
Does the FileEntry inherit from something like FrameworkElement?
Aug 4 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bob Rosen | last post by:
The description given in "Customizing Items Dynamically in the DataList or DataGrid Web Server Control" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbCode/...
1
by: Tom Bean | last post by:
Is it possible to dynamically add items to a menu and use one event handler for click events? If so, how do you detect which of the new items was clicked? Thanks, Tom
2
by: JJ | last post by:
I am populating a listbox with Items dynamically during run time. That is fine!!!. How can I add an image to (just one standard) to each item in the list box dynamically. Thnaks JJ
2
by: Stephen Miller | last post by:
When I dynamically populate a HtmlSelect combo box, the Value property consistently fails to return the item selected, defaulting instead to the first item in the list. For example: Protected...
1
by: Sender | last post by:
Can we change the position of Menu Items in MainMenu dynamically? If yes... then how?
7
by: Steve_Black | last post by:
Hello, I'm toying with the idea of loading a MenuStrip (VB.Net 2005) dynamically based on who is logged into my system. Every user has different security settings and I want to customize the...
0
by: Puja | last post by:
hi all, I have asp.net menu control on my page. I want to hide some menu and sub-menu items dynamically depending on user. (i.e after user is logged in) is there any property like ...
5
by: Andrus | last post by:
I have database containing translations. I'm creating VS 2005 WinForms application which should use this database to translate menu items to user language. I replaced lines in myform.designer.cs...
1
by: Vivien Parlat | last post by:
Hello, I'm trying to create the equivalent of a textbox which could format different kind of "values" using a string. Currently i can do this: (myObject is an ItemsControl) <myObject>...
0
by: kirankumarn | last post by:
I have a asp:menu control and i'm binding menu items dynamically and the width of the top menu items is variable. So i want the width of the menu list should be equal to top static menu items, i want...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.