.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

Applay gloabal styles from external dll (referenced assembly); styles without x:key don't automatic

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :JQuery

In wibdow1.xaml I add the ResourceDictionary1.xaml to the wibdow.resources.

I define a simple style without x:key for button in ResourceDictionary1.xaml .

And all buttons in window1.xaml get the style of button defined in Dictionary1.xaml.

Till now there is no problem.


I have another project, whose output type is dll file (class library) Resources.dll.

In this project I have ResourceDictionary2.xaml.


If in wibdow1.xaml I add the ResourceDictionary2.xaml to the wibdow.resources instead of ResourceDictionary1.xaml, and add the reference of Resources.dll in

View Complete Post

More Related Resource Links

The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must



This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


On web.config I already have this:
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?


Conditional styles for selected Html.ActionLink


Hi, I am trying to add an item selected class to an Html.ActionLink, I am very new to MVC so its all a bit confusing.

So far i have each of my ActionLinks lookins like this

<li><%: Html.ActionLink("Home", "Index", "Home", new { @class = ViewData["current"] == "Home" ? "selected" : "" })%></li>

And in the controller i have

public ActionResult Index() {
            ViewData.Add("current", "Home");
            return View();

Can any one tell where i am going wrong because the links now fail to respond, basically it isn't checking the condition == Home and if it is then its failing because it doesn't get to the controller.

Any ideas would be appreciated


External Assembly for Controllers...


I am just learning MVC, so bear with me.

I would like to have a project that contains all of my Controller logic. I'm not concerned with using Areas, as these are still maintained within the same project. 

Consider this scenario:

I have multiple sites/apps that require the exact same interaction in regards to a particular area, say CRUD ops on a user account. I do not want to create all of the controller logic for one site/app, recreate it again for the next, and make sure that I keep all maintenance to each in sync. I would prefer to keep the controllers in a separate project and reference them from the appropriate site.

I know someone will say that the controller logic is a lot of times specific to the application (as I've read elsewhere), but let's just say that it is guaranteed to be the same. I want to focus on the "how" and not the "why".

So far, I've created a class library project with the appropriate references for accessing System.Web.Mvc. How do I proceed with the routing configuration for this? Is this idea even possible? I read a few older articles that were written when Areas were first being introduced that said to create separate projects for them. Is this idea similar to that?

Thanks for your time and noob tolerance.

Can't change Gridview row colors or styles in the DataBound event


I was highlighting certain rows in my gridview using code like this in the DataBound event:

        if (e.Row.RowType == DataControlRowType.DataRow)
            int vendorCheck = 0;
            //TODO make this shorter
            if (DataBinder.Eval(e.Row.DataItem, "vendorId") != System.DBNull.Value)

The condition of creating assembly for external access permission?

To create an EXTERNAL_ACCESS or UNSAFE assembly in SQL Server, one of the following two conditions must be met: 1. The assembly is strong name signed or Authenticode signed with a certificate. This strong name (or certificate) is created inside SQL Server as an asymmetric key (or certificate), and has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission (for external access assemblies) or UNSAFE ASSEMBLY permission (for unsafe assemblies). 2. The database owner (DBO) has EXTERNAL ACCESS ASSEMBLY (for EXTERNAL ACCESS assemblies) or UNSAFE ASSEMBLY (for UNSAFE assemblies) permission, and the database has the TRUSTWORTHY Database Property set to ON. The two conditions listed above are also checked at assembly load time (which includes execution). At least one of the conditions must be met in order to load the assembly. This is a explanation on msdn.I think if only one of these condition is met,it will work. But after I do the first condition,I still can not create an assembly with EXTERNAL_ACCESS permission except SET TRUSTWORTHY on. should the two condition be met?  

Styles based on themselves?

Hi, I'd like to create e.g. a button style, change the template but keep the rest of the original button style (like minheight/height). How do I achieve this? Atm, I'm using this: <Style x:Key="Button" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> <Setter Property="Template"> <Setter.Value> <...> </Setter.Value> </Setter> </Style> I get the following exception in visual studio (note: it just shows up in vs error window, it compiles and runs fine): "In den Eigenschaftsausdrücken wurde eine Schleife erkannt." (Unfortunately, I don't have the English excpetion message, as far as I understood it basically says you should not create a style based on itself) If I remove the BasedOn-thingy, my buttons get smaller than the normal ones and I'd like to have a solution for this where I don't have to set all the original controls' behaviors and which works also for other controls.   Tobi

Styles and derived styles at the app.xaml level

Hi, We have a bunch of standard styles (in XAML Resource Dictionaries) that are defined for company wide consumption and we merge them into our App.XAML in all our applications. In some applications we want to override some portions of the standard company wide styles again at the application level (we could do this at the window level but that is not preferrable and maintainable). But this doesn't work. What we notice is that if we have a style defined for Button in our company-wide style definition (merged into App.XAML), then we cannot derive from it and override it within our App.XAML - this probably is because there are multiple style definitions for Button and the last one replaces (rather than override) the previous. So, can anyone suggest a good way to handle this scenario? Again, we don't want to override styles at Window level, we want to do so preferrably at App level. Thanks

CreateWindowEx(...) P/Invoke Confusions with Window Styles and Extended Window Styles?

I am trying to create a window manually from C# using P/Invoke in order to make a tiny wrapper for some calls into Direct2D for a small application that is written in a functional idiom.  However, I am having a problem with a basic call: IntPtr hwnd = CreateWindowEx(0x16010000u, sWindowName, sClassName, 0x00050000u, cw_default, cw_default, cw_default, cw_default, (IntPtr)0, (IntPtr)0, hInstance, IntPtr.Zero); The first and fourth arguments which I state numerically here are bitmasks for the extended window style and the window style respectively.  I find (from Spy++) that the resulting window on execution has these style values instead: 0x16C10000u and 0x00050100u respectively.  Apparently a WS_CAPTION style is being added to my style bitmask at some point, and (perhaps consequently) WS_EX_WINDOWEDGE is being added to my extended styles.  I do not work with UIs much and have not used the window APIs from Win32 for a very long time, so perhaps I am making a silly mistake; perhaps there is some value in WNDCLASSEX that can somehow force WS_CAPTION to be added?  I am unsure if there is something obvious I am doing wrong either with the API or from the C# side.  Could I be making a marshalling mistake in the P/Invoke itself?  My extern declaration looks like this: [(DllImport("user32.dll")] s

applying styles to xml element while reading it from webservices

hi,i have one xml document. i used to read the xml from webservices using c# and display the xml document content in the popup window. i wish to apply style for the xml element in the xml document. codes:  xml document:       <?xml version="1.0" encoding="utf-8" ?> <BubbleHelp> <Module name="ADMIN"> <HelpItem ID="BRANCHID"> <B>Hello</B>World!! ---bold format style is not applying while display it in the popup window </HelpItem> </Module> </BubbleHelp> webservice code used to read the xml document.      helpTopic[0]  = tagnode.InnerText; //text between the node i.e Hello World!!        

Getting Warning as Error: Assembly generation -- Referenced assembly 'mscorlib.dll' targets a dif

I built a sp application on a dev environment and the code worked.  I moved the whole project to a different dev environent (i.e. differmt machine name, domain, etc), and when I try to compile, I get the above error (also, one about System.Data.dll) If I understand, it means VS 2010 is getting confused as to use the 32 bit or 64 bit GAC?  If thats true, how do I force this in vs? thanks  Rocky Sanders


I have written my first WPF app and I can see where I will want to use many of the styles over again in other apps. Is it possible to store them in a separate file that can be loaded into new projects?

Styles in Wiki Page versus Web Part Page

Hi there, I have a web part that was working perfectly fine in a wiki page (in the site pages library) - however as soon as I add that web part to a webpart page I lose some of my styles that are applied inline. More specifically I had some inline styles in a <tr> tag to show a border-bottom however that border-bottom just does not display in the webpart page. In the wiki page it displays perfectly fine. Any help is appreciated. Note: The reason I don't want to use a wiki page is because of this known problem: http://support.microsoft.com/kb/981227 Thanks  

how to apply styles on the message displayed by asp.net required field validator control?

 Hi,I want to apply styles on the message (i.e. Name field is required) display by the asp.net required field validator control.Styles=border, padding, background-color, font-color, font-weight, img etcAnd I also want highlight the border or asp.net textbox and asp.net dropdown list with which this control is associated.  RequiredFieldValidator does not have style property !Can anyone let me know how can I do this???Regards,Dazy

Styles not applied

i have a setup like <ribbon:RibbonGallery> <ribbon:RibbonGallery.Resources> <Style TargetType="ribbon:RibbonGalleryItem"> <Setter Property="Width" Value="24" /> <Setter Property="Padding" Value="0" /> </Style> <Style TargetType="Rectangle"> <Setter Property="Width" Value="16" /> <Setter Property="Height" Value="16" /> </Style> </ribbon:RibbonGallery.Resources> <ribbon:RibbonGalleryCategory Header="Automatic Color" HeaderVisibility="Collapsed" IsSharedColumnSizeScope="True"> <ribbon:RibbonGalleryItem Width="auto"> <StackPanel Orientation="Horizontal"> <Rectangle Fill="Black" /> <TextBlock Text="Automatic Color" Margin="12,0,0,0" FontWeight="Normal" /> </StackPanel> </ribbon:RibbonGalleryItem> </ribbon:RibbonGalleryCategory> <ribbon:RibbonGalleryCategory x:Name="themeColors" Header="Theme Colors" MinColumnCount="10" MaxColumnCount="10"> <ribbon:RibbonGalleryCategory.ItemTemplate> <DataTemplate> <Sta

Hover and Selected Styles for Menu

I am using the following code to create a static menu, but using images instead of text..   <asp:Menu ID="Menu1" runat="server"> <Items> <asp:menuitem navigateurl="default.aspx" text="" imageurl="Images\nav_Home.gif" popoutimageurl="Images\nav_Home_selected.gif" tooltip="Home"> </asp:menuitem> Can anyone tell me if it's possible and how to perform an image swap on hover and also an image swap on click so that it is clear which menu item has been selected? Many thanks. 

ASP.net Website - Styles and Java script not working on Mozilla firefox



       I developed a ASP.NET website. The style sheets are loading and the site is working well on Internet explorer. But When I open in Mozilla firefox/ google chorme The sytle sheets doesnt work and the javascript also doesnt work. I am not sure what to do to make my website compatible with firefox/chrome. Can someone tell me what needs to changed or where the problem usually arises in this kind of scenarios?



WPF List box styles

Im quite new to WPF , I really what to turn a listbox on its side so the content images scroll left to right .  Hence the selection being in the image in the centre.  

What i really want to achive is simular to this http://steverodgers.blogspot.com/2008/01/wpf-coverflow-clone.html  but as im quite new to wpf im not sure how these styles are asigned to the listbox and im waiting to hear back from the aurthor.

If anyone can give me an example of one of the above that would be a real help .   ideally as much code as posible to the title block so i can how it all ties in .



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