.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

TreeView - multi select - why so complicated?

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :WPF

I can’t understand why whoever implemented the TreeView implemented it such a way that it is impossible to easily extend to support multi selection (actually, why didn’t they add it to begin with????).


I was looking at how to implement this in my TreeView derived base class and implement it in a way that would not require any style or template changes per tree. I have spend some time looking at the implementation using Reflector, and it seems to me that ‘if only’ the TreeView.ChangeSelection had been exposed as a virtual method instead of internal, then it would have been possible to ‘hack’ it, but unfortunately this is not the case.


So – after a lot of searching I have not been able to find any solution which would require code changes only. Is it possible at all?.

View Complete Post

More Related Resource Links

How to multi select items in WPF Treeview using Shift Button


I have a requirement where i have to create a WPF Treeview, bind it to a dataset.
Then i have to provide functionality for user to select nodes either using Ctrl or multi select using Shift button.

I am able to write code to do all the tasks above except multi select using Shift button.
Following is my XAML for Treeview.

<TreeView Name="tvOutput" ItemsSource="{Binding}" Height="200" VerticalAlignment="Top" MouseMove="tvOutput_MouseMove" DragLeave="treeView_DragLeave" SelectedItemChanged="Tree_SelectedItemChanged">
                                <!-- This Style binds a TreeViewItem to a Node. -->
                                <Style TargetType="{x:Type TreeViewItem}">
                                    <Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=TwoWay}" />
                                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                                        <Trigger Property="IsEnabled" Value="True">
                                            <Setter Prop

Treeview: Select all children if Parent is selected etc...



I'm using a Treeview with  ShowCheckBoxes="All" , so basically I have a tree with all CheckBox Nodes. I'm using the TreeView inside an update panel, and populate the Tree code behind dynamically.

My requrements are the following:

1) Select all the children if parent is selected,

2) When parent is selected, and if we de-select a child, set parent unselected

3) Track if new nodes were selected and previously selected nodes were de-selected (becasue I need to update the database according to the selections in the Tree)

For above 1, I do the following:

protected void TreeView1_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
        foreach (TreeNode node in TreeView1.Nodes)
            TreeNodeCollection col = node.ChildNodes;
            //select all children when the parent is checked
            if (col != null && node.Checked)

Use BDC data in list as multi-select column

I have a document library that uses values from another system for its metadata.  Right now, we copy the values from the primary system into SharePoint so users can choose them.  I want to find a way to use the BDC connection that I have set up to automatically pull those values.  The problem is that the current metadata is set to multi-select.  So, I have a file that is in the library and it can be used for multiple clients - clients is a column in my library and users can select many entries.  When I set up a column to pull BDC data, it only allows single entry.  Does anyone have any ideas?

DVWP connections with multi-select lookup columns

I have a question concerning the Data View Web Part using SharePoint Designer 2007.   I have two list (A and B). List A has a lookup column (called B-items) with multiple selections to items in List B(using the Title column from B).   I create a web part page and insert a data view of using List A. I create another data view with data from List B. Next, I make a Web Part Connection between the two data views with A passing B-items column as parameter to List B data view. I then create a filter on the List B data view with a comparison of List B’s Title column equal to the parameter of List A’s B-items value when a user selects an item from List A data view. The problem is nothing appears in List B’s data view.   When I try the reverse of the above scenario it works fine.     I understand that this is properly functionality, but is there a way to achieve my first scenario? If so, how can it be accomplished?   I have looked through the web for help and found the answer here http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/749b7477-f37f-4724-94b3-b6ace770e73a seems to be what I’m looking for. However, I am unsure how to implement his code into the web part page.   I am a worse than a novice with xsl so if anyone gives an example I would greatly appreciate step by step on what code is needed a

NULL label doesn't appear on drop down or multi-select parameter.

Hi, I am using SSRS 2005 SP3. I have the following query that I use for my parameter: SELECT 0 AS c1, 'NOT Specified' AS c2 UNION SELECT 1 AS c1, NULL AS c2 UNION SELECT 2 AS c1, 'Test 1' AS c2 UNION SELECT 3 AS c1, 'Test 2' AS c2 Let's call my parameter prm1. The type of prm1 is string and it has "Allow null value" and "Allow blank value" options ticked. C1 is the value field and C2 is the label field for prm1. When I preview the report, and I didn't see NULL in my drop down list,  but that record has been shown as 1 (which is the value). I am wondering if this is a normal behavior of SSRS? It's not a big deal. I can replace NULL with something else, but I am just curious. Cheers, Uzzie

ReportViewer 2008 multi-select parameter alignment

We are using SSRS 2008 SP1 & ReportViewer 2008 SP1. The multi-select parameter options are left aligned in the drop-down listbox on the Report Server but when run thru ASP.Net & reportViewer, they are aligned in the center of the drop-down list. This is very problematic because the width of the drop-down is also narrow compared to the text size of the fields. I tried wrapping the ReportViewer in a Div tag (<div style="vertical-align: left; text-align: left">), but still no joy.  Would appreciate any help thanks.

Multi select control does not work with Infopath. :(

I create new lookup column that allows multiple values.  The important part is the column is the Title(linked to item) so the item is shown as Hyperlink item to the actual item.  This works fine, but then I would like to fine tune my form with infopath.  When I open this form it complains about these columns, basically will not let me open the form without first deleting these lookup columns.  So I then try the other way I create a lookup column from infopath and this work fine, the only problem being is these items no longer so up as hyperlinks to the original items.  This is a major bumma, any one have any suggestions to get this working?

Multi Select Sorting help

I need help with a bit complex JavaScript. This is what I am trying to do: I have a database table with id and title. I am populating the multi select list with the values "id + title" (ex: 1234 Title1) What I need to do is sort the list based on the items selected. There is a sort button which when a user clicks after selecting his titles should push the selected items to the top of the list and sorted and the list that's not selected must also be sorted based on the title. For ex if I have these in the select list:my options will look like this <option value="122" id="001">122 Amazing Facts</option><option value="890" id="002">890 Famous Seven</option><option value="345" id="003">345 Niagara Falls</option>......<option value="100" id="007">100 Zimbabwe</option>122 Amazing Facts 890 Famous Seven 345 Niagara Falls 879 Spain Champions 865 Trinidad & Tobago 213 Victoria Falls100 Zimbabwe They are all sorted on the title (or the ID since I am populating them based on the titles). This will be the first pass when I populate them. Now the user selects 890 Famous Seven, 213 Victoria Falls, 100 Zimbabwe and hits the sort button. The result should look like this 890 Famous Seven 213 Victoria Falls 100 Zimbabwe 122 Amazing Facts 345 Niagara Fa

Form Display is very slow to display, (using large multi-select lists)

Hi, I am looking for some suggestions on how to speed up a few very slow forms. We have created some Leaver and Joiner type forms for our IT guys. They contain some lookup data , and we need to pick multiple values from a hidden list. Unfortunately this (Systems/Roles) list is large (3000 rows and growing). On a couple of forms there are 2 of these multi-select boxes, and things are getting pretty slow to display. Any suggestions? ---------- Background Info / things I have tried: The forms are based on Site content types and Site Columns. A set of 5 Combo boxes is slower than one Multi-select list. SPDesigner is available but I do not have Central Admin rights I am not alowed to write/install custom code on the server. (Visual Studio code / Codeplex code / extra Features etc) :-( I have had to resize the Multi-select list, so am using the SPServices JQuery call to make the multi-select box wide enough for the text. But this is extra overhead so I might have to back that out / replace with a fixed width for the multiselect box (if I can find it's id, so I can do that in Javascript). Filtering the Multi-select box is possible, but only after the page has initially loaded (it seems) (again I tried the SPServices Jquery call) The Company intend to add more Content types, so I am trying to avoid a custom Newform.aspx for each type (Leaver / New Joiner / Transfer/ C

API SSRS 2008 for php multi-select

Hi, I use API SSRS 2008 for php .  We have create with a report builder  a report to use multi-select. In the manager web SSRS we can use  multi-select filter option. But with API i don't see the possibility to use multi-select. Is-it possible ? Regards Marc       

Linked Reports - Multi-Select Parameters


I have searched for this but have not found any answers, or similar questions even. I have a report with several multi-select parameters. These parameters are populated by datasets that use stored procedures. When I go to "Properties" and "Parameters" of the linked reports, they do not populate the drop-down menu for the parameter, the parameter is simply blank and has an area for me to manually type in data. Is there any way to force these parameters to populate with a selectable list of options? Like would occur when running the report from the front-end interface, or setting up a subscription.


selected option items in (multi-) select box on ASP pages are not highlighted if the select box is d


Dear community,

I've an asp application with vbs using input forms containing select objects with the property "multiple" specified. If the select object is disabled, the selected option items aren't highlighted. This behaviour occurs with IE8 and also with IE9. In earlier versions of IE everything worked fine. You can reproduce that also with a simple HTML page like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<Select style='width:200;height=200' disabled multiple>
 <option selected>option1</option>
 <option selected>option3</option>
 <option selected>option5</option>

<Select style='width:200;height=200' multiple>
 <option selected>option1</option>
 <option selected>option3</option>
 <option selected>option5</option>



Is there a workaround for that?

Thanks in advance!


Multi Select List and Filter Capabilities



I have a custom list created and one on the columns is a Choice list with the multi select option.  I need to be able to filter by the data based on one selection from that choice list.  For example, this choice coloumn is for a list of job role.  I need users to be able to select their role so to filter to what they need to see in other coloumns in that same custome list.  I have tried adding the sharepoint filter above my list however, that column is not an option to select on due to the multi select option. Is there an easy way to filter on that column.

MDX Calculation for multi-select in Excel

Dear all,

I'm having a problem with one of my calculations. It's working perfecty for one selected unit (e.g. year '2010', or quarter 'Q2' for year 2010, or month 'july' for year 2010).
But, in my report in Excel, I MUST have option to select multiple values of date (e.g. quarter 'Q1' and 'Q2', or months 'january' and'february') because some other of my calculation needs multiple values of date. 

What I need is to tell me how to change my calculation when I chose multiple values of date? Is it even posible?
-if you select three months: 'january', 'february', 'march' then I want last month 'march' to be saved in some variable (or if there is some other method, even better) that can be used for making SUM of Amount on period (from begining to latest selected date) described in code below. 

[Date].[Year - Quarter - Month - Date].CurrentMember,
[Date].[Year - Quarter - Month - Date].[Year]

IIF([Date].[Year - Quarter - Month - Date].CurrentMember.Level.Name="Year" 

Multi-select Refinement Search Web part


Hi Everybody,

i want to create a SharePoint 2010 Search Center with Refinement Panel Web part. but instead of single select keyword, we need to create a multi-select refinement web part. can anybody provide a solution for this ???

Multi-select Refinement Search Web part


Hi Everybody,

i want to create a SharePoint 2010 Search Center with Refinement Panel Web part. but instead of single select keyword, we need to create a multi-select refinement web part. can anybody provide a solution for this ???

How do I - pass multiple params from multi-select drop down on one report to another via action


Report 1 - 3 params:  @Status =Y,N  @FromDate, @ToDate.  Report one shows 2 cols (Status, Total). 

 @Status gets values from shared dataset - getStatus

Status      Totals
[Status]    [Total]

I created an action [Total] when clicked runs another report that accepts the same 3 params (Status, FromDate, ToDate) and works fine if i only select one of the status' from the status param drop down.

I am trying to create an action on [sum(Total)] that will run the same 2nd report with both status' selected.  Show it should show me details of all Y and N

The second report will work if i set the 2nd report @Status param to no default value.  But i want a user to be able to run the 2nd report by itself if needed so i set the @Status param to Get Values from a Query, which get the same dataset as report 1 which is getStatus.  It will not populate the 2nd report Status field when I do this.  I am forced to set it to no default values.  Is there a way to pass both the Y and N from report 1 to report 2 and still keep the drop down multi-select box on report 2 for Status?

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