Image source
Hi,
is it possible to directly show an image that is retrieved physically like the below?
out.println("</body><img src='http://192.168.125.125:8988/Application1-Project1-context-root/showworkloadimgservlet'></html>");
Hi,
Question is not clear anyway i guess you expecting <af:image and put correct URI for source attribute.
See:
http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_image.html
Similar Messages
-
How to set image source path in formsweb.cfg file in forms 11g
Hi,
I had written HTML code in the formsweb.cfg file in forms 11g. In the below code i am unable to retrive image file(i.e., .gif, .jpeg) from the server or local machine.
In the below HTML code i set image source in the image tag as below:
<img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_04.GIF"
Is this correct path to fetch the images from the server or local machine .
Please help me out how to set path for image in html or is there any alternate process to retrive images.
Here is the code :
[INDIVIDUALUAT]
workingDirectory=D:\Aims10dev\Work
form=LMstartup.fmx
userid=rmenu/rmenu@RLIFEQA64
codebase=/forms/java
imageBase=codebase
width=1005
height=750
WebUtilArchive=/forms/java/frmwebutil.jar,/forms/webutil/jacob.jar
WebUtilLogging=off
WebUtilLoggingDetail=normal
WebUtilErrorMode=Alert
WebUtilDispatchMonitorInterval=5
WebUtilTrustInternal=true
WebUtilMaxTransferSize=16384
baseHTMLjinitiator=webutiljini.htm
baseHTMLjpi=webutiljpi.htm
archive_jini=frmall_jinit.jar,life-icons-round.jar,Agilis_Icon.jar,life_Icon.jar,personalize.jar,hyperlink.jar,amazingbutton.jar
archive=frmall.jar
separateFrame=False
lookandfeel=Generic
EndUserMonitoringURL=True
usesdi=yes
#HTMLbeforeForm= <table width="1005" border="0" cellspacing="0" cellpadding="0"><tr><td width="200"><img src="/forms/html/agilis-life-logo.gif" width="200" height="80" /></td><td width="10"><img src="/forms/html/agilis-life-new11_02.gif" width="36" height="80" /></td><td width="805" valign="top" background="/forms/html/agilis-life-new11_03.gif"></td></tr></td></tr></table>
HTMLbeforeForm=<body topmargin="0" leftmargin="0" > <table width="1005" height="100" border="0" cellspacing="0" cellpadding="0"><tr><td width="200" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-logo.gif" width="200" height="80" /></td><td width="10" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_02.gif" width="36" height="80" /></td><td width="550" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_03.gif" width="550" height="80" /></td><td valign="bottom"><table width="219" height="90" border="0" cellspacing="0" cellpadding="0"><tr><td height="36" valign="bottom" align="center"><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agile-logo.jpg" height="36"></td></tr><tr><td height="10" valign="bottom"> <div align="right"><span style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; text-decoration:none; color:#00000; " >Home | Change Password | Logout</span></div></td></tr><tr><td colspan="3" valign="bottom"><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_04.GIF" width="100%" height="39" /></td></tr></table></td></tr></td></tr></table></body>AFAIK, this is not the correct way to set the image location.
We call the working directory as context, so inside the context root along with WEB-INF, maintain a folder with name img and put all the images in that directory.
You can use either .\<image_folder> or the optimum way would be (if you are using JSPs) to use getContext() method and traverse accordingly.
FYI,,, using getContext() will give you context root directory, from there it is as simple as accessing any other folder.
Hope this answers your question.
Cheers,
Jeets. -
Have to toggle "Relative to" button each time I try to change an image source
Dreamweaver CS4 running on Windows 7.
When changing an existing image on an existing web page in Dreamweaver by double-clicking the existing image on the page to open the Select Image Source panel, I have to toggle the "Relative to" (Site Root / Document) button for each image.
In other words, say that when using Design view, I want to replace img1.jpg with img3.jpg, and IMG2.jpg with img4.jpg, The steps I have to take are:
1. Double click img1.jpg on the page to open the Select Image Source panel.
2. Select img3.jpg.
3. Click the Relative to button at the bottom of the panel and change it from whichever it is on (Site Root, let's say) to the other option (Document).
4, Then click OK.
5. Double click img2.jpg on the page...
6. Select img4.jpg
7 Select the other option (SIte Root) in the Relative to drop down
8. Then click OK
9. Repeat for each image whose source is being changed. If one is relative to Site Root, the next will have to be relative to Document, then the next again I have to select Site Root, etc.
If I don't select the other relative to option, the image source path will not change when I click OK.
Default Link Relative To in site definition is set to Document.
It's been like this for weeks now and it's starting to get annoying. Any ideas?David, I tried deleting the corrupt cache flie, no difference. Deleted the config folder, same. Other than I lost the extensions... and had to reinstall them.
However, John's answer is correct. And clicking another image before clicking the one I want is faster than the way I was doing it.
It makes no difference if they are .png .jpg or .gif images.
By the way, I was wrong about my DW version. Turns out it's CS3. Guess it's time to upgrade... one of thes days!
Thanks everyone!
Message was edited by: tarfh, to add sentence about png images. -
Use different "fx-border-image-source" for first tab and remaining tabs
Hi,
I'm using something like this
.tab {
-fx-padding: 0px 5px -2px 5px;
-fx-background-insets: 0 -20 0 0;
-fx-background-color: transparent;
-fx-text-fill: #c4d8de;
-fx-border-image-source: url("images/tab5.png");
-fx-border-image-slice: 20 20 20 20 fill;
-fx-border-image-width: 20 20 20 20;
-fx-border-image-repeat: stretch;
-fx-font-size: 22px;
.tab:selected {
-fx-border-image-source: url("images/tab-selected5.png");
-fx-text-fill: #333333;
-fx-background-color: red;*/
to customize the tab appearance of a TabPane.
That worked well. But I need to use a different set of images for just the first tab. Does anyone know a way to accomplish that?
Thanks.How can I "fix up" the first tab of tab panes that are created after I "fixed up" the first tab of the initial tab pane?
My app allows user to create new tab panes at any moment during program execution.Not easy to answer this one.
The best answer would be to use structural pseudoclasses, but (as David points out), they are not yet implemented.
The trick here is how to identify the first tab of each tab pane so that it can be styled separately from the other panes.
Doing the styling without a dynamic lookup is preferrable to using a dynamic lookup (i.e. when the first tab is created give it a specific style, e.g. tab0).
This is how the charts work, where they set style classes based on series of data, e.g. series0, series1 - this allows you to independently style each series of data.
However the chart stuff has all of that built into the implementation, whereas the tabs don't. To achieve that you would likely need to go into the TabSkin code (http://openjdk.java.net/projects/openjfx/) find out where and how it generates the Tab nodes and write a custom tab skin or extension of the existing one which assigns a numeric style class to each new tab in a pane (e.g tab0, tab1, etc). In other words, not particularly easy if you are unfamilar with the tab skin implementation. You could log a javafx jira feature request to have those style classes set on tabs - file it here => http://javafx-jira.kenai.com.
In the meantime a simple alternative is to use the dynamic lookup method in my previous post and a hack such that whenever you add a new tab pane to the scene you do something like the following:
new Timeline(
new KeyFrame(
Duration.millis(50),
new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
Node tab = newTabPane.lookup(".tab");
if (tab != null) tab.getStyleClass().add("first-tab");
).play();The reason for the Timeline is that I don't really know at what stage the css layout pass is executed. I know that when you initially show the stage and then do a lookup, the css pass seems to have already been done and the lookup will work. But for something that is dynamically added or modified after the scene is displayed - I have no idea when the css layout pass occurs, other than it's some time in the future and not at the time that you add the tabPane to the scene. So, the Timeline introduces a short delay to (hopefully) give the css layout pass time to execute and allow the lookup to work (not return null). Not the best or most efficient solution, but should work for you. -
Image.source in ItemRenderer works in Windows but not Mac
I have a Flex (AIR) application that is giving me problems on
the Mac. In one of the
Datagrids, I am using an ItemRenderer with an image control.
Some code in the
"set data(value:Object)" function assigns a file path as the
source of the image
control as follows.
imgThumb.source =
File.documentsDirectory.resolvePath("pdqtemp").nativePath +
"/" + data.strJPGFileName;
This works correctly in Windows , but not on the Mac.
In this case, the path resolves to the following on the Mac.
/Users/brian/Documents/pdqtemp/artist_01t.jpg
I have verified that the file is in the right place and when
using the path in
the command line console, it correctly addresses that
directory and file. I
don't normally develop apps for the Mac so I am sure there is
something I am
missing.
Any ideas?
Thanks for your help.Hi Jed,
Thanks for responding
That is the exact path assigned to the Source of the Image
control. However, it isn't exactly a trace of the Image.Source
property.
The code in question is attached
The alert shows the path I originally posted and shows that
the fileImgThumb.exists returns False.
As I mentioned, this works perfectly in Windows. There is
some code elsewhere in the app that creates the thumbnail. That
does work on the Mac as the thumbnail image is created and saved
where expected.
I am not sure what I might be doing wrong.
Thanks for your help,
Sid -
imglist = arraycollection which contains names of images
which are coming from database
myimg = array of images
all images are stored in newfolder
how to use tilelist itemrenderer for imagesHi Jed,
Thanks for responding
That is the exact path assigned to the Source of the Image
control. However, it isn't exactly a trace of the Image.Source
property.
The code in question is attached
The alert shows the path I originally posted and shows that
the fileImgThumb.exists returns False.
As I mentioned, this works perfectly in Windows. There is
some code elsewhere in the app that creates the thumbnail. That
does work on the Mac as the thumbnail image is created and saved
where expected.
I am not sure what I might be doing wrong.
Thanks for your help,
Sid -
Change image source distorts new image
Is there any easy way, once I change image source in Edge Animate, to get it to at least be proportionally correct? When I change an image source with a different size, it comes in distorted.
If you change the source it will fill the boundaries of the original source image automatically. If the size is different, it is probably better to delete the original image and drop the new one.
If you are talking about loading an image dynamically and changing them dynamically, use css background image with no-repeat and have you div be the size of the largest image used unless you code the image size when they change. -
Changing Image Source programmatically
Hi
I've got a problem changing my image source based on a value in a variable.
The following function gets kicked off, but I get a TypeError: Error #1009: Cannot access a property or method of a null object reference. error.
I've tried embedding, and the solution you see below (which i found here - as I am chaning it at run time http://forums.adobe.com/message/116979#116979), but no luck
I am certain its how I'm mapping the png, but I can't be sure..... any suggestions? I've been banging my head against my desk for ages on this!
function (note - the trace proves that the value to change the image is correct)
public function LeversComplete():void{
if(PodContentBase._ProjectDetail.getItemAt(0).IndustryLeadingMastery == "N")
trace("Value" + PodContentBase._ProjectDetail.getItemAt(0).IndustryLeadingMastery)
imgIndustry.source = "/assets/bigcheese.png";
else {imgIndustry.source = "assets/Nocheese.png"}
Image (note - this is set as a defualt - and defaults in fine)
<mx:Image id="imgIndustryleadingtechnicalmastery"
source="assets/bigcheese.png"/>
Picture of Directory Structure:Hi - all done - dead right - The image didnt exisit and i'm trying to stuff things in it - what a divvy -
Anyways, this worked - I check if the image exists before I try and change it.
public function LeversComplete():void{
if (imgIndustryleadingtechnicalmastery){
if(PodContentBase._ProjectDetail.getItemAt(0).IndustryLeadingMastery == "N") {imgIndustryleadingtechnicalmastery.source="assets/nocheese.png"}
else {imgIndustryleadingtechnicalmastery.source = "assets/bigcheese.png"} -
Conditional image and image source in SSRS
I have images stored in database for some of the items but not for the others. If there is no image in the database I would like to display static placeholder image embedded in the report.
Is there a way to achieve that? The problem I experience is that there is no way to specify expression for Image Source. I tried to use expressions for Value field (when Image Source is set to Database) to specify the name for embedded image depending on
condition but nothing I tried worked.If your image is embedded in a tablix then, yes, you are sourced to a single dataset. However the Lookup function pulls in "related" data from another dataset. Related is in quotes because there are ways to fool it. The syntax is:
=Lookup(index_current_dataset, index_other_dataset,field_to_get_from_other_dataset, other_dataset_name)
If you have a second dataset, "Second", that returns a single column, "Picture", that is your default image, you can retrieve that image using lookupset as follows:
=Lookup(1,1,Fields!Picture.Value,"Second")
the 1,1 is used to fool the lookup expression. Since 1 will always match 1, it will return everything in the dataset, which is the single image. Throw that into a logical check (IIf) and you get:
=IIf(IsNothing(Fields!RelatedImage.Value), Lookup(1,1,Fields!Picture.Value,"Second"), Fields!RelatedImage.Value)
That said Andre's approach should work also. the example may be for embedded but the principle should work for db as well since you can set a formula for visibility. Yours is in a tablix so it will require some tweaks.
In the cell where the image will be embedded, first add a rectangle. The rectangle will allow you to add 2 images to the cell. Add your default image and set its source to whatever you like. It can even be an embedded image. Now add a second image and set
it to your database image field. In the visibility property of each image set it show or hide based on an expression:
default image expression: =IIf(IsNothing(Fields!Image.Value),false,true)
db image expression: =IIf(IsNothing(Fields!Image.Value),true,false)
You will want to set the cell width/height so it is equal or smaller than 1 image in design view. A table cell can grow bigger at runtime to accommodate more content but not smaller. Because of this, you need to set the design-time cell height and width
equal or smaller than a single image.
The advantage of this approach is that the default image does not need to come from a dataset like with my suggestion.
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek. -
Don't Cache Image Source URI?
Is it possible to set an image source to a URI without the app caching the image to disk? I am streaming a JPEG file that is rewritten every 40ms and I want to refresh the image source to playback like a video but it's only loading the image once
and never refreshing it.
Thanks,
Gavin
EDIT I should note that this is my code. I am using the IgnoreImageCache option but it's not doing aything:
BitmapImage bmp = new BitmapImage(new Uri("http://192.168.94.53/image.jpeg"));
bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
IMAGE.Source = bmp;
Also tried this and it didn't work:
IMAGE.Source = null;
BitmapImage bmp = new BitmapImage();
bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
bmp.UriSource = new Uri("http://192.168.94.53/image.jpeg");
IMAGE.Source = bmp;Hi im.thatoneguy,
Try this:
private void Button_Click(object sender, RoutedEventArgs e)
image.Source = null;
BitmapImage bmp = new BitmapImage();
bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
bmp.UriSource = new Uri(@"http://10.168.196.118/iis-85.png?" + DateTime.Now);
image.Source = bmp;
Tested locally, works fine, adding timespan as GET request can help to refresh.
--James
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Updating image sources - scale problem.
Hi everyone, found out that FC could do something incredible today - you can update the image source of any images in your project to update them.
Sadly though, I can't seem to get it to scale the images down, despite the fact there's a 'scale: stretch' menu below it. Seriously, it doesn't matter if I've I've got the scale set to 'stretch' 'tiled' or 'none', whenever I replace, the image is GIGANTIC or tiny, and what I want is for Flash Catalyst to conserve the previous image dimensions and constrain or stretch the new image to those dimensions accordingly. I would have thought 'stretch' would have done this, but it seems to do nothing?
Is there a plug in or something? It'll save me a lot of time! Thanks (using 5.5 trial by the way)Flash Catalyst does not support plug ins. Before you invest too much time in learning Flash Catalyst, you should know that Adobe has annouced that it has stop development on this product. Via Flash Builder, you can set the maxWidth and maxHeight values on the image component.
Chris -
Af:image source outside of application
Hi I use Jdev 12c
I have a folder which contains images, this folder is outside the app
I did this to save space in the Database,
I'd like to know how to access it to show it
I used
<af:image source="/home/diego/Pictures/aaa.png" id="i1" shortDesc="Hi"/>
but it didn't work I checked the generated code and it shows like this:
<img id="r1:2:i1" title="Hi" alt="Hi" class="xkx" src="/test/home/diego/Pictures/aaa.png">Having a folder which contains images makes the folder within the app, not outside as indicated. Having images in a database would make the images outside the app.
What is the images folder placement?
"Only image data deployed with the application below the web root (not within the WEB-INF folder) is directly accessible."
JDev11.1.2.1.0: Handling images/files in ADF (Part 3) | JDev &amp; ADF Goodies -
Set Image source programmatically
I am working on a use case, where I have to set image source programmatically based on an input value. Eg: When I have a value of 'House1' in a form field, I have to display House1.png picture from a folder in file system. How can I do this?
Thanks Timo.
JDev Ver: 11.1.2.3
I used the easy solution to have the images in a sub directory under root and accessing them using EL language. It is working fine. I have another question, as to the process to be implemented if I have to update the images. The application that I am working on has a need to update the images frequently. What is the best way to do it? I am thinking of creating a jar file for images and deploying it to web logic server Ishared library). If I have to add a new image, I can just make a jar file and re-deploy it again. I am new to ADF, so I am not sure if my approach is correct. Please advise.
And, thanks for your blog. It was helpful.
-Ashok -
Create a trigger which set Image source with binding to a dependency property.
I'm trying to create a specified button which switch images every time it pressed, without using the Click CBFunction, so I'm using toggle button and triggers (checked unchecked) and I want this button to
supply DP of string so who ever uses is button will only have to specify the images paths and a click CBFuntion to
perform what ever he wishes.
I managed to create the mechanism for switching images with triggers(but the triggers image paths are hard coded and not using DP) and to enable setting a click CBFunction. When I switch the hard coded image path with a DP which return a string with
the path the program crush, an exception is thrown.
U.C xaml:
<UserControl x:Class="ButtonChangeImage.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Grid>
<ToggleButton x:Name="btnCI">
<ToggleButton.Content >
<Image Name="img" Source="C:\Users\AmitL\Desktop\joecocker.jpg"/>
</ToggleButton.Content>
<ToggleButton.Triggers>
<EventTrigger RoutedEvent="ToggleButton.Checked">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference img}" Storyboard.TargetProperty="Source">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<BitmapImage UriSource="{Binding FirstImage}"/>
<!--<BitmapImage UriSource="C:\Users\AmitL\Desktop\james-brown-010.jpg"/>--><!--if I switch to this line it works fine!-->
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="ToggleButton.Unchecked">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference img}" Storyboard.TargetProperty="Source">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<BitmapImage UriSource="C:\Users\AmitL\Desktop\joecocker.jpg"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ToggleButton.Triggers>
</ToggleButton>
</Grid>
</UserControl>
U.C cs:
public partial class UserControl1 : UserControl
public static readonly DependencyProperty FirstImageDP = DependencyProperty.Register("FirstImage", typeof(string), typeof(UserControl1), new PropertyMetadata(@"C:\Users\AmitL\Desktop\james-brown-010.jpg", new PropertyChangedCallback(FirstImageSource)));
private string m_strFirstImage = string.Empty;
private BitmapImage m_oBMImage = null;
private static void FirstImageSource(DependencyObject obj, DependencyPropertyChangedEventArgs args)
UserControl1 l_UCBtnSwitchImage = (UserControl1)obj;
l_UCBtnSwitchImage.m_strFirstImage = (string)args.NewValue;
l_UCBtnSwitchImage.m_oBMImage = new BitmapImage(new Uri(l_UCBtnSwitchImage.m_strFirstImage, UriKind.Absolute));
public string FirstImage
get
string l_strTemp = (string)GetValue(FirstImageDP);
return l_strTemp;
set
SetValue(FirstImageDP, value);
public event RoutedEventHandler Click
add { btnCI.Click += value; }
remove { btnCI.Click -= value; }
public UserControl1()
InitializeComponent();
window xaml:
<Window x:Class="ButtonChangeImage.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:ButtonChangeImage"
Title="MainWindow" Height="350" Width="525">
<Grid>
<m:UserControl1 Click="ToggleButton_Checked" FirstImage="C:\Users\AmitL\Desktop\james-brown-010.jpg"></m:UserControl1>
</Grid>
</Window>
The exception:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '20' and line position '46'.
I would love to know why when I switch the hard coded value with DP it suddenly throw exception, how to fix it or if there is other way to achieve U.C with those demands.
Thanks.Hey Magnus,
Unfortunately I get the same result, the button is switching between the (Joe Cocker) image to blue button(normal pressed button look) how come the
(Joe Cocker) image return I didn't set a trigger for unchecked so what make it change the content
or the image source back to that image?
And I can't debug (by the way what's happening there how come it doesn't stop in all those code lines?).
I didn't make any changes here is all the code:
U.C cs:
namespace ButtonChangeImage
public class ImageConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
string s = value as string;
var source = new System.Windows.Media.Imaging.BitmapImage();
source.BeginInit();
source.UriSource = new Uri(s, UriKind.RelativeOrAbsolute);
source.EndInit();
return source;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException();
public partial class UserControl1 : UserControl
public static readonly DependencyProperty FirstImageDP = DependencyProperty.Register("FirstImage", typeof(string), typeof(UserControl1), new PropertyMetadata(@"C:\Users\AmitL\Desktop\james-brown-010.jpg", new PropertyChangedCallback(FirstImageSource)));
private string m_strFirstImage = string.Empty;
private BitmapImage m_oBMImage = null;
private static void FirstImageSource(DependencyObject obj, DependencyPropertyChangedEventArgs args)
UserControl1 l_UCBtnSwitchImage = (UserControl1)obj;
l_UCBtnSwitchImage.m_strFirstImage = (string)args.NewValue;
l_UCBtnSwitchImage.m_oBMImage = new BitmapImage(new Uri(l_UCBtnSwitchImage.m_strFirstImage, UriKind.Absolute));
public string FirstImage
get
string l_strTemp = (string)GetValue(FirstImageDP);
return l_strTemp;
set
SetValue(FirstImageDP, value);
public event RoutedEventHandler Click
add { btnCI.Click += value; }
remove { btnCI.Click -= value; }
public UserControl1()
InitializeComponent();
U.C xaml:
<UserControl x:Class="ButtonChangeImage.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Grid>
<ToggleButton x:Name="btnCI" xmlns:local="clr-namespace:ButtonChangeImage">
<ToggleButton.Resources>
<local:ImageConverter x:Key="conv" />
</ToggleButton.Resources>
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Content">
<Setter.Value>
<Image Name="img" Source="C:\Users\AmitL\Desktop\joecocker.jpg"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content">
<Setter.Value>
<Image Source="{Binding Path=FirstImage, Converter={StaticResource conv}}"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
</UserControl>
Main Window cs:
namespace ButtonChangeImage
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
private void ToggleButton_Checked(object sender, RoutedEventArgs e)
MessageBox.Show("f");
Main Window xaml:
<Window x:Class="ButtonChangeImage.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:ButtonChangeImage"
Title="MainWindow" Height="350" Width="525">
<Grid>
<m:UserControl1 Click="ToggleButton_Checked" FirstImage="C:\Users\AmitL\Desktop\james-brown-010.jpg"></m:UserControl1>
</Grid>
</Window>
Thanks,
Amit. -
Bind StorageFile to Image source
Hi All,
I am developing an App in windows phone 8.1 , which contains thousands of storage files binding to images in listview.
I am first getting stream from file and preparing in to bitmap in converter class and return bitmap to imagesource property which takes lot of time and memory exception,Is there any best way to achieve this , i.e can I directly bind storagefile/filepath
to image Source, if yes please give an example.
Thanks
SarveshHi Sarvesh,
I found a thread talking about this similar question, please refer to the following link to see more.
https://social.msdn.microsoft.com/Forums/windowsapps/en-US/51c43447-0289-4b93-9ba7-a5f1ef57d1a6/how-to-bind-image-into-into-listview-template-image-location-is-in-library-folder-?forum=winappswithcsharp. Note it is a store app thread, but you can use the
code snippet in your phone project.
Feel free to let me know if you have any concerns.
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate
the survey. -
Question about dynamically changing image source
hi, this might be a stupid question that i've simply never
seen, but i have a picture on a page that, when the user clicks a
link below, needs to change to an altered picture. probably very
simple, i just need code that will change the image source of a
named image by clicking a link. thanks for any help you can give
me.You can use a remote rollover technique that uses css
(nesting one or more elements inside an anchor link) and absolute
positioning, or JavaScript.
Here is a quick JavaScript to achieve this effect:
xhtml code
<head>
<script src="external.js" language = "javascript" type =
"text/javascript"></script>
</head>
<body>
<p><a href="new_page.html" id="arrow"> New
Page</a></p>
<img src="images/image1_off.gif" width="100" height="20"
id="arrowImg" alt="arrow" />
</body>
external JavaScript file
window.onLoad = rolloverInit;
function rolloverInit() {
for (var i=0; i<document.links.length; i++)
var linkObj = document.links
if (linkObj.id) {
var imgObj = document.getElementById(linkObj.id + "Img");
if (imgObj) {
setupRollover(linkObj, imgObj);
function setupRollover(thisLink, thisImage) [
this.Link.imgToChange = thisImage;
this.Link.onmouseout = rollOut;
this.Link.onmouseover = rollOver;
thisLink.outImage = new Image();
this.Link.outImage.src = this.Image.src;
thisLink.overImage = new Image();
thisLink.overImage.src = "images/" + thisLink.id +
"_on.gif";
function rollOver() {
this.imgToChange.src = this.overImage.src;
function rollOut() {
this.imageToChange.src = this.outImage.src;
There is a lot going on here but if you know a little
JavaScript it will be failry easy to work it out. The important
thing is to note the file layout, naming conventions and image
constructs. Make sure the ids, etc are matched in the functions and
html code.
This technique shows the user what the image will become if
they click the text when they mouse over the text link. This is
handy for showing a preview of an image. You can alter the script
to change the image without a preview if you don't want that
effect.
regards
Nick Barling
www.barkingweb.com
Maybe you are looking for
-
Files get converted to temporary files
hi !! i am having an odd problem, whenever i save my captivate work and close it the file automatically gets converted to a temporary file. Even if i rename it back to .cp and save the file all over again and close captivate the file again gets conve
-
Error "Internal error occurred checking the external " while creating a job
Hi All, I am getting an error while trying to schedule a job, Im not very shure abt what the job does, the user tried it and she got an error and asked me to do it. A similer kind of job has been created in an other system and it work
-
How to use android app in my how to use android app in my hp 15 touchsmart notebook pc
Hello how can I use android app in my hp 15 touchsmart notebook pc???
-
Why the metadata created with EM can't be found in JDeveloper
I created some dimensions and measures. then put them in a cube.And I created a measure folder and added the measures . I do all the task with EM. And when I use JDeveloper to build a crosstable, only the demo measures and dimensions are in the avail
-
Home button doesn't work ( everyonce in a while)
okay, heres my problem, ill open an application, lets say stocks, and then when i want to go back to the home screen i will hit the home button and it won't do anything, then i ll hit it again and it brings up the music controls. the only way for me