473,563 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I add items dynamically to a WrapPanel?

19 New Member
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 7516
Frinavale
9,735 Recognized Expert Moderator Expert
The items need to be WPF controls.
Does the FileEntry inherit from something like FrameworkElemen t?
Aug 4 '17 #2

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

Similar topics

0
1551
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/ html/vbtskCodeCustomizingItemsDynamicallyInDataListWebControlVisualBasic.asp ) says "The examples use the DataList control, but apply to the DataGrid control as...
1
3891
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
3062
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
5794
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 WithEvents Fruits As System.Web.UI.HtmlControls.HtmlSelect Protected WithEvents Results As System.Web.UI.WebControls.Label Protected WithEvents...
1
1535
by: Sender | last post by:
Can we change the position of Menu Items in MainMenu dynamically? If yes... then how?
7
10050
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 main menu instead of showing all possible options and only enabling/disabling certain ones. I have a table that stores the menu item name, parent...
0
2312
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 navMenu.Items.Visible = false; OR
5
4978
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 like Text = "File"; to call my translating routine
1
7816
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> <myObject.Items> The value of abc is: <SomeHandler DataContext="{Binding abc}">
0
1591
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 to do this using css Thanks in advance
0
7659
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.