.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

Connect DataTemplate from resource , to existing class.

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :WPF
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


<src:CatList x:Key="cat"/>


first Thanks.

Where <sr

View Complete Post

More Related Resource Links

Connect to existing sql 2005 database


Hello There,

I had successfully restored sql 2000 database to sql 2005. It works like charm

Now i am creating a database model in MVC

I follow these steps

Right click on model > ADO.NET entity data model > Generate from database > New connection (Microsoft sql server) > server name > select or enter database name

But no server name AND database name show in both drop down lists. When i mannually enter database name (which exists in sql 2005) then click on TEST CONNECTION. It gives follwoing error

"A network-related or instance-specific error while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections.

Kindly help me with this


Connect to an existing connection manager from within a custom transformation?

I'm developing a custom data flow transformation and have hit a roadblock.  I need to create an ADO connection to one of the connection managers that's defined in the package already.  I can either hardcode the name of the connection manager, or define it as a custom property....the problem I'm having is accessing it at all.  What I've found is that ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager only has the connection managers defined by the component itself, not already existing in the package.  How do I create a connection to a connection manager that's defined at the package level at design time? Thanks

Able to connect to non existing host

I made a little program that connects asynchronously to a host to check if it´s port is open or not: socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Dim result As IAsyncResult = socket.BeginConnect(IpAddress, port, Nothing, Nothing) Dim isConnected As Boolean = result.AsyncWaitHandle.WaitOne(1000, True) It works just fine, but then this 1 person told me that he never seemed to get an offline notification when the server it´s off.   I sent him a simple test program using the code above that connects to an inexistent host (, and sure enough, he got an "On" message. He says his network works ok. He can play online, navigate webs and so on with no problems at all. I´m out of ideas. Am I doing something wrong in the code? Or is there some explanation to his network behaviour?   Thanks in advance.

Set DataTemplate from resource programmatically

Hi,   I am trying to style one of my columns in my ListView. I have created a DataTemplate in one of my resource files: <DataTemplate x:Key="MyTemplate"> <Border BorderBrush="Brown" BorderThickness="2" CornerRadius="5"> <Border.Background> <LinearGradientBrush> <GradientStop Offset="0" Color="Wheat"/> <GradientStop Offset="1" Color="LightCoral"/> </LinearGradientBrush> </Border.Background> <TextBlock Foreground="Blue" FontWeight="Bold" Margin="5" Text="{Binding Id}" Width="Auto"/> </Border> </DataTemplate>   In my XAML I have added this resource file. I use other stuff from this file so that part works fine. <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="MyTemplates.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources>   However, I don't create the columns in XAML, instead they are created in C#: ((GridViewColumn)c.Value).CellTemplate = (DataTemplate)FindResource("MyTemplate");   Now, when I run this I get an exception saying it can find the resource "

add an extra method to an existing class


Suppose that I want to implement another method for a class namely hasFiles for System.IO.Directory , How can I do that?

for example if I add <Extension()> _  tag before each function or Sub I can add a new function or method for each Control.

How should it be for a specific Class?

Cannot connect new Servers to existing MOSS 2007 SP2 farm


We have Single Server MOSS 2007 SP2 farm with DBA managed database server. We have different web applications running and deployed several solutions (SharePoint Learning Kit, Facet Search, workflow extensions, new themes) in the farm.

Recently we wanted to scale out our farm by adding one WFE and one indexing server. I have installed MOSS 2007 SP2 slipstream in the C drive (default location) of both the new servers. Then before running the SharePoint Product & Technology Configuration Wizard I uninstalled MOSS, restated the servers and reinstalled MOSS 2007 SP2 slipstream in D drive.

I didn't add farm administrators group to the local administrator group of the new servers but I added my own account which is a member of farm administrator group to local administrator group. I didn't add Central Admin Webapp pool identity account (which is a service account) to the local administrator group either. But this service account as well as farm administrators group account has dbcreator & securityadmin privileges in the sql server, both t

add string in existing resource file


hi there
i need to add a string in a existing resource file
i am trying this but does not work
do you know the problem?

Private Function AddString(ByVal file As String, ByVal result As String)
        Dim language As Google.API.Language = Google.API.Language.English

        Dim resxFilePath As String = file '"c:\files"  

        Using rr As New ResXResourceReader(resxFilePath)
            Dim outputFilePath As String = resxFilePath.Replace(".vb", "") & ".resx"

            Using rw As New ResXResourceWriter(outputFilePath)

                rw.AddResource(result, Replace(result, Chr(34), ""))


            End Using
        End Using

    End Function

Adding an SP 2010 server to an existing farm. "Failed to connect to the configuration database." dur


I have an existing sp 2010 enterprise server hosting websites and central administration.  I have a seperate sql 2008 r2 server holding the databases.  My goal is to setup another sp 2010 enterprise server to provide redundancy for the websites and central admin.  I believe I am able to accomplish this by adding another web front end to the farm.  On the second server, I install sp 2010, run the config wizard and connect to the config database located on the sql server, however, I am interrupted at step 3 when I am notified of the following:

Failed to connect to the configuration database.
An exception of type System.InvalidOperationException was thrown.  Additional exception information: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
System.InvalidOperationException: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
   at Microsoft.SharePoint.Administration.SPEncryptedString.CheckCredentialLock()
   at Microsoft.SharePoint.Administration.SPManagedAccount.Deploy(SPApplicat

Sequence and Class Diagram of an Existing Website



I want to undertand and change an existing website which was written long time back. It cntains a lot of code and I dont know where to start as there is no dicumentation.

Is there any way by which i can create a class diagram and sequence diagram of the existing one as I want to incorporate all the existing functionalities in the new one and dont miss out anyone. Only way I know is to debug the current application and go through whole of the code individually. Is there any way out by which I can undertand the current application quickly?

Any help is greatly appreciated!



how to inherit a dynamic class from existing base class in C#?

i have created   dynamic class using CodeDom,but now i,want to inherit the dynamic class from my base class...becoz i have created methods in my base class n now i want to inherits these methods from that base clss in  my new dynamic class....plzzzzzzzzzzzz someone help me i have search alottt but didnt find any piece of code...i also tried reflection.emit but i face same problem in Reflection.emit...so plz help me..

Class Diagrams

Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Static Class for Beginners

In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

InfoPath 2010 cannot connect to SharePoint 2010

You have installed Office 2010 beta and you are trying to connect to SharePoint 2010 from InfoPath but you get an error

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

MessageQueue Class

This sample demonstrates two way communications using message queuing between a device application and a desktop application. One application sends book order messages to a message queue and another application receives these book orders from the message queue and responds to the device queue that the orders have been processed.

could somebody give me example how I can connect to database only once if I use many models in contr


I use in my ASP.NET MVC application repository pattern and I use in controller for example 3 models:

   namespace MvcApplication1.Controllers  
        public class HomepageController : Controller  
            private IWebsitesRepository _repository_websites = new WebsitesRepository();  
            private IFirmRepository _repository_firm = new FirmRepository();  
            private IPhotosRepository _repository_photos = new PhotosRepository();  

In WebsiteRepozitory, FirmRepository and PhotosRepository classes I have:

Database1Entities _entities = new Database1Entities();

So I have 3 connections to database ? Is it wrong ? How can I solve it ?

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