.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 change image\parameters on style definition ?

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

I define some new button style.
The style default background is image X.bmp and when on 'mouseOver' is true the image is changing to Y.bmp

I have 10 buttons on the code that need to use this style - and each of the button need to show different image as default different image on 'mouseOver' event.

I can set the bitmap on each button on the button constructor - but i don't know how to set the image in this case on the style definition level.

Someone can help here ?

View Complete Post

More Related Resource Links

WebGrid: column definition - Set 'style:' parameters depending on value


I have a list of objects (List<myObject>) which I pass to a webGrid. I would like to set cells for a column of the table to a specific value depending the object's 'StatusColor' property. Something like

List<myObject> myObjectList = 
WebGrid webGrid = new WebGrid(source: myObjectList, ..);
columns: webGrid.Columns
webGrid.Column("Status", "Status", format: @<text>@item.StatusName</text>, style:



But for some reason, I get "cannot convert from 'lambda expression' to 'string'". When I remove the @<text> suround the item property, I get "the name '@item' does not exists in the current context"

For the 'format:' part, it works fine.

how to make a css style background image be linked to an image in the resource file


hey guy, i need help in a very troubling matter. I want to make a textbox with a specific style, within this style a set of images as background parts, how can i attach these images to the custom control as whenever i take the .dll file and add it to the toolbar the images do not appear. So i tried to make them as resource files and their property as embedded in .resx file, so how to make the css style background image url to be linked to any of those image.

thanks in advance

change image button image


i am making a web form with a VB code behind.  on the form I have a down arrow imageButton that when pressed hides certain data.  what i want to do is change the button to an up arrow and vice versa whenever pressed.  i have both images loaded onto my project already.  any suggestions.

thank you

Is it possible to change the title bar background and the font style on default template?



Is there any way to change the default top link /title bar picture and the fonts of the title without breaking anything in the layout/structure?

I have changed the theme to Obsedian and I would also like to change the picture of the title bar of this theme and also the font/style of the title, top link bar, menus..etc. Is there a way to do this?

Please note: I am using WSS 3.0 and I am not the Administrator of the sharepoint. I am only the site admin of some sites on this sharepoint. I can do some basic customization using SPD.

Basically, what I am trying to do is that I want to set up a sharepoint site, however I want to make it NOT look like a sharepoint site.Well I know this is possible, but for my case it might be just partially possible due to the limitation that I am not the Site collection admin and hence I do not have direct access to the server itself.

What I want is to hide most of the sharepoint links/menus/bars, etc and use my own buttons/hyperlinks etc .. for user to navigate on the sites.

Thanks in advance for your help/advices.



change css and image url

HiI have a masterpage on a site, in order to use the site the user has to login first. And after that I  would like to customize the masterpage with a unique css file and a unique imageurl for a image on the masterpage. Whar is the preferable way to achive this?

Use update progress control to change image control imageurl

UPDATE: Apologies for the previous formatting error - hopefully the post is now more readable... Hi I have a button with an image control next to it. Before the button is clicked, the image control "ConfirmedStatusImage" shows a "cancel.png" image. When the button has been clicked (and some other code successfully executed), then I change the imageurl for the "theConfirmedStatusImage" to show a "ok.png" image. Quite a bit of time can often pass between clicking the button and the associated code executing, so I have an ajax update progress control that shows a "bluespinner.gif" image while the page is updating after the button click. At the moment, the update progress updating image appears next to the "ConfirmedStatusImage" control. However, I would like to change things so that when the update progress starts, the imageurl of "ConfirmedStatusImage" changes from "cancel.png" to the update progress image (i.e., the "bluespinner.gif"). Then, when the update is complete, then the image should change to the "ok.png" image. My question is: how can I achieve this? As far as I can tell, the update progress control does not have any events that I can hook into. Also, placing the "ConfirmedStatusImage" inside the ProgressTemplate would not work either, as this only displays

Change "View Report" button style

Hi,    How can i change the style of button "View Report" ? I want to change the image.     Tks!    

assign style to image in codebehind

how can i assign the style declared in <window.resources> in xaml to the image dynamically created in the codebehind like : Image img=new Image(); img.Style=?? thanks

WPF: To change the ListView highlight style, what Targettype we should target?

we want to change all list controls (listBox and listView) highlight style by change its border and background. For ListBox, we target to ListBoxItem. it works great. For ListView, we target to LisViewItem, it does not work. What TargetType we should target to? thx! <Style TargetType="{x:Type ListViewItem}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Foreground" Value="Blue" /> <Setter Property="Margin" Value="5,0,5,0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListViewItem}"> <Border x:Name="Bd" Background="Transparent" CornerRadius="3" SnapsToDevicePixels="true" BorderBrush="{x:Null}"> <ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" SnapsToDevicePixel

Change image button image on hover

Hoep this si simple I would like to change the image in an image button when the user hovers over it ..can anyone helpThanks  

Change image when mouse over!

I want to know that how can I change an image when mouse over image?!?!   thanks.

Change style for aspMenu items

I am using a aspMenu that renders the horizontal global navigation with useSimpleRendering="true" so that a list (ul,li) menu implementation is used rather than the table implementation.  My question is - how do I change the style of the UL, LI elements? They have class names such as "root static", "static dynamic children", etc. etc.  I can overwrite the css definition for these styles in my custom css. But what if I want the implementation to use my css element names? I tried with using the "CssClass=classname" and "UseSeparateCss=true" for the <Sharepoint:AspMenu> .... but this doesn't seem to have any influence on the CSS elements for the List. Any suggestions? Thanks in advance, Jake.

Change image paths programmatically



I am working on a localization project, some of the localized text are in graphics, some of the example graphics  paths:




My web forms use <asp:image> controls and <img> tags (runat = sever) to point to graphics in /en/images. I need to a function to loop through all image control and point them to different paths based on the locale set at runt time. Which event should I override and how do I write it?

All my web pages inherit from a base page, I don't know if that makes differences.




Change dimensions of image if width exceeds certain amount


(In a different post  I asked about how to access an Image control held in a FormView template. This topic has been mixed into it, so I thought I would start a fresh post only about this problem.)

I would like to perform a simple check to ascertain the width of an image. If it exceeds a certain dimension I would like to give the image a width property. I understand this doesn't not affect file size, just dimensions, but it is for presentation purposes. I'm still learning VB, but the code below is what I have tried so far:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim LargeImage As Image = DirectCast(FormView1.FindControl("Image1"), Image)

        Dim Width As Integer
        Width = LargeImage.Width.Value

        If Width > 560 Then
            LargeImage.Width = Unit.Pixel(560)
        End If

    End Sub


Thanks in advance,


Change ReportViewer Style



Plz can you tell me how to change the reportViewer style, for example how can i change the color of the button 'Show Report' or the viewer background.Thanks



Change image in gridview after binding


I have a need to change the image (bound) in a gridview after it has been databound.  Basically i need to assign a photo to a record and I want to change the image url for that row.  I can change the text in any of the cells of the row but I can't seem to find property for the imageurl.

This is what I do to change the text(cell 5).

int index = int.Parse(Session["NSI"].ToString());

GridViewRow row1 = GridView1.Rows[index];
row1.Cells[5].Text = "just some text";

But now I need to change the image url for cell 0

something along the lines of ...

row1.Cells[0].ImageUrl = "~images\photos\12345.jpg";

How do I get to that property?

Thank you.

How to change CSS style for unordered list item in master page using VB


When a user logs in to the site, I'm trying to change the color (to "white" -- but only when there is a logged in user) of a list item that is contained on my master page. It is not working. Below is the markup and error message. What am I doing wrong? Thank you.

<script runat="server" language="vbscript">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim currentUser As MembershipUser = Membership.GetUser()

        If currentUser IsNot Nothing Then
            acme.Style("color") = "white"

        End If

    End Sub
    Protected advertise As System.Web.UI.HtmlControls.HtmlGenericControl


On same master page:

<div id="menu">

<ul> <li id="acme"><a href=".

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