.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to make a TreeView custom ItemsSource behave like normal TreeViewItems?

Posted By:      Posted Date: September 25, 2010    Points: 0   Category :WPF

I have made a custom class to populate a TreeView thru its ItemsSource. That class heritates ObservableCollection.

The thing is that its nodes doesnt seem to be TreeViewItems because i cant apply code that works for normal treeviewitems.

I'm talking about code to do right click select, etc.

Can somebody tell me how can i solve this problem?



View Complete Post

More Related Resource Links

How to add custom nodes for a treeview

Hi the actual procees of my work is initially i will have a root node for a treeview. If i right click on that i will have a context menu with some options. If i select add new from that i will add a text file as child node to the root node. This works fine . After adding that text file i would like to add a child node under that text file..   The over all flow will be Initially when page loads my treeview will be with a single rootnode   ACH If i add a text file i would like to show my treeview as follows   ACH |-> some.txt    |->A( Child for some.txt)        |->B(child for  A)             |->C(Child for B)   Up to A i was succeded but i do not know how to add the remaining also i would like to set image index for the custom child nodes added  

How can I handle the loaded events for all TreeViewItems in a TreeView?

I have a custom control that inherits from the TreeView control. Here's the code I have right now:   public ModdedTreeView() { this.AddHandler(TreeViewItem.LoadedEvent, new RoutedEventHandler(ItemLoaded)); } protected void ItemLoaded(object sender, RoutedEventArgs e) { TreeViewItem item = e.OriginalSource as TreeViewItem; } Unfortunately my handler seems to be handling the TreeView loaded event instead of the TreeViewItem loaded event. The original source is always the TreeView.   What is going wrong?

Error creating a normal Custom List


I am using the normal sharepoint screans to create a custom list. When I click create it falls over with

'w3wp.exe (0X2254) 0X2C80 CMS Publishing 8Ztg Medium Got list item version, but item was null. ' on the log files.

This is a publishing template site with no VS custom list definitions.
This is just a normal site.

What can i do to rectify this.

Add custom popup menu to treeview



I need to add a custom popup menu to a treeview.

The treeview is populated with a SharePoint site and displays all the lists from that specific site.

The treeview is something like this:

 |--+List Name 01
 |  |--+List01 Item 01
 |  |--+List01 Item 02
 |  |--+List01 Item 03
 |--+List Name 02
 |  |--+List02 Item 01
 |  |--+List02 Item 02
 |  |--+List02 Item 03

But i want to display that custom popup menu only when i right click on the list name (List Name 01, List Name 02.....).

If i right click on the root node or an item in the list i don't want to show the popup menu. Only if the selected node is a list.

Thank you very much for any info, code, help ...


how to make Use custom Confirm box in Asp.net


I have a Custom confirm box with Yes No.....The function executes in Jquery when click on Yes/No.

But I want to exec my code there.....how it is to be done?

Thankyou in Advance

This is code

//This is the file creating ConfirmBox

<script type="text/javascript" src="scripts/jquery.alerts.js"></script>

<script type="text/javascript" >
    jConfirm('Do you wan

How to Make a custom property or a page persist across postback



As the title suggests, I have an object to hold some specific state information in my web application - I pass it back & forward between pages by making it a property of a basepage which works fine, but I lose it on postback.

Is there any way to persist this property without manually adding & reading it again from viewstate?



TreeView with custom site map(security trimming enabled)


Hi all

I am really having tough time fixing this issue, Can anyone please guide me on this..

Here is my situation, I am developing a Portal having 2 xml sitemaps(one for visitors and one for registered users)

Web.sitemap (default) and Loggedin.sitemap(securitytrimming enabled)

I am binding sitemaps to Treeview.When i enable my security trimming  for loggedin.sitemap  i am having these issues.

1.Sitemappath is going blank 2.Selected Node color is not changing. 3.Selected node is not expanding.

 Here is th

how to make a TreeNode in treeview as the 1st child node for every or specific Parent Treenode? w




How to  make a treenode  as the 1st child node for every parent node or for some specific parent nodes.

thanks in advance

How to make a TreeView's and ListBox's SelectedItem stay in sync? (in an MVVM app)



I'm certain this has come up before, but I haven't been able to find the answer.

I made a basic ViewModel that contains a list of People (an array of Person) with a property called SelectedPerson, which naturally points to the currently selected Person in the list of People. I also have a ListBox and a TreeView that are databound to the ViewModel's People list.

What I'd like to do is to keep the ListBox's SelectedValue and TreeView's SelectedItem in sync with with the ViewModel's SelectedPerson. The idea is that no matter how the SelectedPerson is modified (through a control, through code, etc), all the controls should update themselves properly by selecting the correct item. I can get it to work with two ListBoxes, which is nice, but I can't get it to work with a ListBox and a TreeView because the TreeView's SelectedItem is readonly and apparently unavailable through XAML.

Where should I look to get ideas on making this work?

Also note that I'm trying to make this work in pure XAML. No code-behind as XAML files in my application can be loaded and changed dynamically.


How to make Custom SharePoint 2010 Webpart work on MOSS 2007 Environment



I've built a SharePoint WebPart in SharePoint 2010, using SharePoint Assembly version Now i've to make this Webpart such that i should work on SharePoint 2010 and MOSS 2007. The version no for both the versions are different, so do i need to create separate web-part for both version or is there any other way?

My current webpart is built in env, which has

SharePoint 2010, Windows 7 64 Bit, VS 2010.

Reference is added to SharePoint DLL which is in 14 Hive ISAPI.


How can i make this generic, so that i should work on both version, i've not used anything specific which is only in SP2010, its just a simple webpart.


Akhilesh Nirapure

Migrating Custom Site Definition to SharePoint 2010: Do i need to make any changes to existing site



I am migrating from SharePoint 2007 to Sharepoint 2010.

We hae 2 custom workflows to be migrated.I have deployed the respective wsp which were used in Sharepoint 2007 site.But it did not help and i got errors.

Do i need to change my site definiton or my wso before deploying the same to Sharepoint 2010


Ram kiran

ComboBox with Custom ItemsSource DataBinding Issue



I'm using VS2010 and .NET 4 do create a WPF application. I've a dataset with, say two tables: Patients and MyValues. Patients contains PatientID, FirstName, LastName and Gender. Gender stores "1" or "2" for "Male" and "Female", respectively. MyValues contains DomainID, ColValue (e.g., "1"), and ValueDesc (e.g., "Male"). I've stored the Patient.Gender's DomainID as an ExtendedProperty foir the column in the dataset. I've created a form by dragging and dropping the Patient Details onto a WPF form after setting the Gender's default control to a ComboBox in the DataSources window.

At runtime, I populate the ComboBox items from the MyValues table with a LINQ query as shown below. The ComboBox gets populated correctly, showing "Male" and "Female", and the SelectedValues are also correct. I have not been able to figure out how to hook up the SelectedValue to the Gender field (my Bindidng b below). Any help would be appreciated.



Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

Writing custom MembershipProvider

ASP.NET Membership mechanism allows to use the build-in server tables to store and retrieve user data. By default, this mechanism can only be used with SQL Server database to which Microsoft provides suitable MembershipProvider class.
Inheriting from this abstract class, developer can use his own table(-es) from any database and use any database engine other than SQL Server, like Oracle, DB2 etc.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Write Custom WebParts for SharePoint 2007

The popularity of SharePoint Portal Server 2003 led Microsoft to tightly integrate the next SharePoint version, Microsoft Office SharePoint Server (MOSS) 2007, with its ASP.NET 2.0 WebPart framework. This tight integration enables the ASP.NET and SharePoint developer to do a number of things that previously weren't possible
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend