|
Well, after some more research I found out that the TooltipService is available under 3.0, so this solves most of my problems. Though, it seems that the ToolTipService.BetweenShowDelay doesn't do what I really expected. I have tooltips for items in a listbox that does require some time to retrieve. One issue that I was having is that when moving the mouse down over items, it would try to retrieve the tooltips for almost each row in the list as I was just moving the mouse down. I set the BetweenShowDelay to 0 to try to force the tooltip to always use my InitialShowDelay, but this doesn't seem to work.
I think I am mostly ok now, I am able to have some more control over the tooltips.
|
|
|
|
|
Im trying to write a image from a database to the hard drive and then read it back to the Image Control.
Im getting the error: The process could not access .........\temp.jpg because it is being used by another process
I have a the same app in Winforms and there its simple just put Picturebox.Image.Dispose before you attempt to write over the old file. But in WPF it won't work. I have spent hours trying to figure this out, tried to dispose a lot of resources and Google. But could not find anything.
I don't want to read the picture to the memory because it uses a lot of it.
If someone could help me it would be appreciated, Thanks
my code is
if (imageStorage.Source != null)
{
imageStorage.Source = null;
}
FileStream FS1 = new FileStream("temp.jpg", FileMode.Create);
byte[] buff = (byte[])dRow[1];
FS1.Write(buff, 0, buff.Length);
FS1.Close();
FS1.Dispose();
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(Directory.GetCurrentDirectory() + "\\temp.jpg");
image.DecodePixelWidth = 200;
image.EndInit();
imageimageStorage.Source = image;
|
|
|
|
|
Instead of writing the data to a disk file which gets locked, why not just feed the stream directly to the image.
I Googled the below code snippet, should get you going.
BitmapImage NI = new BitmapImage();<br />
Stream ImageStream = new MemoryStream(byteArray);<br />
NI.StreamSource = ImageStream;
modified 27-Feb-21 21:01pm.
|
|
|
|
|
"I don't want to read the picture to the memory because it uses a lot of it."
modified on Saturday, January 10, 2009 9:27 PM
|
|
|
|
|
What does writing the file to disk get you? Is there are requirement to do this?
Is there a reason to persist the image from the database to the disk, then read disk and load into Image?
After you read the image from the database, it is in memory. That's why is suggested that solution.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Well I have a reason: the images loaded into the memory uses a lot of memory.
reason here is the same to save memory. Its better to write the single file to the disk and keep overwriting it until the user closes the application. Then it will be deleted
|
|
|
|
|
When you set the Image.ImageSource to your file, you are reading it into memory. You can read it directly into your image instead (and overwrite as needed). All writing it to a file before loading it into your image does is create the additional overhead of the File I/O operations.
Hope this helps,
Keith
|
|
|
|
|
How im I reading it into the memory in my code?
The big problem is that If I set imageStorage.Source = null; the source is null but the picture still has a height and width which means the its still in the Image Control?? thats the strangest part. I think if someone would suggest a solution here, it would work.
Allonii
|
|
|
|
|
You are reading the picture into memory when you set the image source equal to the file. If the program is going to display the image, it MUST read the image into memory at some point and WILL keep it in memory for at least the duration of the time it is being shown.
|
|
|
|
|
yes, I'm aware of that but its then referring to the file and by that reduce the memory usage.
I tried to write 10 pictures to the hard drive and read from them and compered the same application but instead reading from a memory stream. Well the app reading from the files used 30-50 % less memory.
That's why I don't see anything positive with reading pictures directly from a memory stream
|
|
|
|
|
Im new in the WPF issues.
I create some WPF object - this object is some square that need to be in some size.
In run time i need to pass somehow the size of the square and i dont know how to do it.
thanks for any help.
|
|
|
|
|
Please post your XAML code
|
|
|
|
|
Yanshof wrote: I create some WPF object - this object is some square
It would really make it easier to help if you specify the class of the "some WPF object".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
SomeWpfObject , it implements ISomeWpfObject .
|
|
|
|
|
I need to read the docs more closely
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
if your squar is any UIElement or a rectangle try this
Rectangle myrect = new Rectangle;
myrect.width = 10;
myrect.height = 10;
myrect.Margin = new Thickness(100,100,0,0);
|
|
|
|
|
if I created a silverlight menu using expression blend, what do I need to do exactly in order to add to my asp.net 2.0 web application?
I know that silverlight needs framerwork 3.0 or 3.5. But my web applcation is built on framework 2.0 so how can I convert it so that I could use the silverlight control?
I need steps please..
thanks in advance
|
|
|
|
|
|
I have a problem with ValidationRules. Basically the data binding works, but the Validate-method of the ValidationRules never fire.
This is part of my XAML (ZoomDialogBox.xaml):
<StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
<Label>Factor:</Label>
<TextBox Name="FactorTextBox" Width="30" Margin="10,0,0,0">
<TextBox.Text>
<Binding Path="." UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validators:ZoomFactorValidationRule MinZoomFactor="1" MaxZoomFactor="20" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</StackPanel>
This is the property I am binding to, and this binding works (from ZoomDialogBox.cs):
public int ZoomFactor
{
get
{
return (int) this.DataContext;
}
set
{
this.DataContext = value;
}
}
As said, the binding works, but the ValidationRules is never applied. What am I doing wrong here?
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
|
I did try that earlier (and now again), and the result is the same. Validate() never fires!
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Your ZoomFactor property should be turned into a property with a backing field.
There are many different ways for the TextBox to bind to the ZoomFactor property.
One way is in the constructor of the ZoomDialogBox.cs file, use this line of code
this.DataContext = this;
Then change the Path in the TextBox to ZoomFactor.
You should also look at the VS Output window to see any data binding errors when your application is running.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Yes, yes yes! Thank you. Now it works.
And thanks for the tip on the Output window, I did not know that databinding errors was shown there. That can be a great time-saver.
Once again, thanks for the help.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Glad you're up and running. Have a great day!
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi I have developed an ASP.Net application which uses silverlight.
This application works fine on my local PC.But when I uploaded it on the web server,it throws an exception saying
Silverlight error code: 2104 error type : InitializeError.
I have added the required(.xap application/x-silverlight-app,.xaml application/xaml+xml, .xbap application/x-ms-xbap ) MIME types to the IIS.
Still it is showing the same error.
Can anyone tell me how can I configure the webserver to support silverlight?
Thanks and regards
ARINDAM
|
|
|
|