473,320 Members | 1,988 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,320 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 7413
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:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.