.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

Making an Observable Collection visible project wide

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

I have an ObservableCollection which I works fine within the Window in which it is defined. (See code below)  However, I can't seem to use this in a second Window. Is this to do with the way it is defined or are there simple techniques for getting at it?


    Public _ocEng As ObservableCollection(Of EnPlayer)

    Public Property EngSqd() As ObservableCollection(Of EnPlayer)
            Return _ocEng
        End Get
        Set(ByVal value As ObservableCollection(Of EnPlayer))
            _ocEng = value
        End Set
    End Property

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        _ocEng = New ObservableCollection(Of EnPlayer)()
        For i = 0 To 4
            EngSqd.Add(New EnPlayer(ref(i), names(i), bat(i), picked(i)))

View Complete Post

More Related Resource Links

How can I bind 2 comboboxes in 2 different WPF windows to the same observable collection?

I have a pretty simple (or deceptively not so) question. I have a WPF application that has a nicely bound combo to an ObservableCollection. I am trying to correctly implement MVVM. One thing I am trying to do (as a test for other things I need) is to have a combo in a popup window have the same content (2-way data bound) as the combo on the main window. I have the main window set up with no issues. <     ComboBox Height="23" HorizontalAlignment="Left" Margin="110,197,0,0" Name="comboBox1" VerticalAlignment="Top" Width="194" ItemsSource="{Binding MyStuff}"/> where "MyStuff" is an ObservableCollection. My problem comes when I create a new wpf application (separate project), put a combo on it, launch it from a button in the first project, and try to bind the combo to the same ItemsSource. I can't seem to figure out the syntax. My 2 issues are as follows: 1. I think the XMAL in the child window needs to have something like this: <     ComboBox Height="23" HorizontalAlignment="Left" Margin="110,257,0,0" Name="comboBox1" VerticalAlignment="Top" Width="194" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ObservableCollection}, AncestorLevel=2}

Removing a (child) user control from an observable collection

Hey all, so I have an ObservableCollection of UserControls.  These user controls have their own xaml and each of these has some type of "Close" button so it would be removed from the ObservableCollection. A groupbox is binded to the ObservableCollection so it would show all the UserControls.  When a user clicks on the "Close" button, the user control is removed from the ObservableCollection and thus, the groupbox.  How can I do this?  I've tried something like   (this .Parent as ObservableCollection<asdf>).Remove(this );   where asdf is a UserControl but I get a bunch of compiler errors.

Callback vs Observable collection

Can a WCF return a Observable collection. which implements INotifyPropertyChanged, and the client be updated on property change, or is callback the way to go, to inform the user of an update on server side.

Binding to an observable collection in a custom WPF control


Hi everyone,

I'll first explain a bit what I'm doing so that the code paste will make a bit more sense. I'm creating a circular menu control for Microsoft Surface (this question is far from Surface specific though, but otherwise this type of control wouldn't make sense :) ), it has some 'pieces' which are all buttons. I've created a 'Menu' control which contains the menu items, I made a custom control for these items (so I could add them to the menu within XAML), and I made a Button control which actually does the drawing of the path etc. I've done this in this specific way because the angle of the button's path will depend on the number of pieces within the menu. Anyway the above all works fine and dandy and I'm happy with the result. However now I'm trying to get all of this to work.

What I want to do is to use MVVM in my application and bind the MenuItems to a command in my ViewModel. So I have an AdminToolbox which is a view containing the menu and there's an AdminToolboxViewModel which is the ViewModel with the command and the items that I'd need to bind to my menu to create the menu items.

Some code pastes:



Checked out to me reports visible on one site in a collection but not on another one


We have two main sites on our main site collection - //myMoss/sites/site 1 and //myMoss/sites/site 2 plus the personal sites //myMoss/Personal/

One of the sites, Site 1 above, has "Veiw Reports" as an option for Site Settings and among those reports is the option to review "Documents Checked Out to Me". The other two sites don't have this feature, which would be a nice feature for all the sites.

The portal has been up for a few years now and have no memory whatsoever as to how I got this to work for first time.

Can anyone remind me? (Moss 2007 BTW)

No combobox ajax control visible in Visual Studio 2008 web project


Greetings -

New user to Visual Studio 2008 - one of the reasons for upgrading from 2005 was because I wanted to use the AJAX Toolbox Control for combobox in my web forms. 

Have started a new project, have told it to use .net 3.5 for the project, but when I go to the ajax tooklkit in the toolbox panel there is no combobox.  Could someone please tell me why it isn't there?

Environment - Visual Studio 2008 SP1

Many thanks - OfficeWonk


Trouble making collection page work "/


 //CollectionPager1.DataSource = empresasBLL.Find(a => a.ID_EMPRESA.Equals(1)).ToList();
            //CollectionPager1.BindToControl = dtlEmpresas;
            //dtlEmpresas.DataSource = CollectionPager1.DataSourcePaged;

Hello I´m using this code to make the collectionPage work with the datalist.

but when I run the application it dissapears with the data.

does anyone know what I´m doing wrong?


Making .NET Project Ready for Build from Perfoce



I'm new to .NET. I've a project checked in to Perforce with single solution file. It has 3 different projects within it. One is ASP.NET, another is web service & another windows service.

Unfortunately, I do not have any build file. For example, I used to have a build file using ANT for all of my Java projects. I'm not sure if the similar functionality can be achieved in .NET. Say for example, by running this build file, it'll create a folder C:\project which will contain my source code in appropriate format. It won't be a truly build file because the source will not be compiled. What I need is that it should put libraries in appropriate folders. I've 3rd party DLL such as log4net.dll & then I've Web References to 3rd party URLs, etc. So, basically, it'll gather those references & then copy source code in C:\project directory along with solution file. And then, I can open this solution file from C:\project in Visual Studio & build it from Visual Studio. Can any one tell me how to achieve it?


Making a global Announcement in Sharepoint ... (corporate wide)



Is there an interesting way to make a GLOBAL announcement in Sharepoint without having to change all the announcement webparts in all the sites?

Better yet, is there a script or an applet or anything, that we can load into Sharepoint (or a feature that it may have) to push an announcement out, and do fancy stuff with the announcement such as NOT SHOW it after the user has seen it, or keep track of who has seen it, etc.

Thanks for your comments in advance.

Bahram Saghari, Bahram.Saghari@hotmail.com


Team Foundation Server: Visual Studio TFS Team Project and Collection Guidance


Microsoft's expert "Ranger" team presents guidance for organizing and provisioning Team Foundation Server Team Projects and Team Project Collections.

Willy-Peter Schaub, Mike Schimmel

MSDN Magazine April 2011

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

Project Example: ASP.NET MVC + SubSonic Architecture

use of SubSonic to provide the DAL in association with some ASP.NET MVC sites and was waylaid in my original intent to throw up a post summarizing the architecture we're using for the effort. Well I've finally gotten around to it. Recall that in his fake it till you need it post, Dave provided a window on our architecture that I'll build upon here

Making Sense of ASP.NET Paths

ASP.Net includes quite a plethora of properties to retrieve path information about the current request, control and application. There's a ton of information available about paths on the Request object, some of it appearing to overlap and some of it buried several levels down, and it can be confusing to find just the right path that you are looking for.

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



VS2010 Professional .NET 4.0 Remote Debugging ASP Website Project


Trying to remote debug ASP website from VS2010 Pro to Windows Server 2003 machine.  Specifically, trying to debug a Web Service, but breakpoint says, "The breakpoint will not currently be hit. No symbols have been loaded for this document."  This happens for all compiled code though.  I have read this is due to missing PDB files and the work around is to manually copy them, as noted here.  Problem is, I cannot find any PDB files for my project, except referenced libraries, which I can remote debug.


  • web.config has <compilation debug="true">
  • Debugger is attached to wewp.exe process on remote server
  • Installed VS2010 remote debugger from DVD (as I can remote debug referenced libraries)

This is beyond frustrating.  I migrated my code from VS2008 .Net3.5 to VS2010 .Net4.0 to take advantage of the inherent multithreading framework.  Debugging works when using local host and was stable until deployment to test server.

Thanks in advance,


How can I be sure that my entire project is up-to-date and free of errors in VS2010?


Seems like a stupid question, but I will go to Build > Build Solution many many times and the build will succeed many many times, then I will put in a minor syntax error and the build will fail, BUT the build will not fail because of the minor syntax error; it will fail because of an unresolved type that I put in about twenty compiles ago. And then I will fix the minor syntax eror, and the compiler will still complain about the unresolved type. Here is my code:

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
  <form runat="server">
  Hello World!!  

Pretty simple, really. I go to Buld > Build WebApplication1 and it runs OK. Now, if I put in a minor syntax error, such as substitute "forrrrrrrm" for "form" and then try to Build Solution, it complains not about the misspelled word, but about the FreeTextBox. And then if I correct the misspelled wird, it still complains about the FreeTextBox. Which leads me to believe that Building the Solution does not check absolutely 100% everything that needs to be checked. Is there a more thorough way of compiling a program that I need to use?

is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site p


is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site project


my current project references




i have a very annoying iis problem

iis server stops working until app pool is recycled


i am hoping that new visual studio (net framework 4.0) may solve this very annoying unsolveable problem


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