|
This is down to how you define a style - if you define the target type instead of the key, it will get applied. For instance:
<Style TargetType="ScrollBar">
<Setter Property="MinWidth" Value="17"/>
</Style> The key thing here is that no key has been added to the definition of the style.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you that worked perfectly :P
|
|
|
|
|
how to close a wpf application.
|
|
|
|
|
Use Application.Current.Shutdown();
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
The big red switch on the back of the computer.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi there, I've been reading the dynamic loading of remote modules. Everything seems pretty straight forward, however, there doesn't seem to be any documentation I've noticed that explains where these "remote" modules can exist.
Are they remote as in the "same" project back on the server or ANY server?
Do the XAP files need to be placed in a specific location, can someone please clear this one up for me?
modified 7-Dec-20 21:01pm.
|
|
|
|
|
Yes. You need to place them in web site.
For example: You have the following Silverlight.
1. Project.Shell
2. Project.Module1
3. Project.Module2
and you have ASP.NET project called Project.Shell.Host.
You need to put Project.Shell.xap, Project.Module1.xap and Project.Module2.xap in Project.Shell.Host that you want to show your Silverlight project.
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Hi experts
I'm totally a newbie to WPF. I need to know if we can draw RichTextBox control with mouse. I'm familiar with mouse events like OnMouseDown, OnMouseLeave, etc, but I don't know how to Draw RichTextBox and similar controls with mouse.
Any help/guidance would be really appreciated.
Thanks and best regards
|
|
|
|
|
The big trick is to capture the mouse after the down click, so you get all the messages. Then you use the events to track a box and position a control in that box.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi Christian,
Thanks a lot for the reply.
This is exactly what I was thinking as an alternative way. But my main point was, "Can we draw RichTextBox,just like a rectangle?"
As an alternative way, we can track down the Mouse Events,draw a simple rectangle for Users to see something being drawn and then get the Canvas/Screen coordinates and replace rectangle with RT Box.
|
|
|
|
|
You don't *draw* a rich text box, you just add one to the parent control, and size it in response to mouse messages. It draws itself.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm writing some code that builds a custom file that combines several additional bits of non-image info along with the image file itself. I can create the file just fine, but when I try to load the file and extract the image from it, I get the following exception from PresentationCore :
The image data generated an overflow during processing.
The inner exception is:
Overflow or underflow in the arithmetic operation.
I load the image as a file stream and saving the resulting array of bytes via serialization. I deserialize to load the file and call this method to retrieve the image (the exception is thrown when it calls Bitmapimage.EndInit() ):
public static BitmapImage BitmapImageFromBytes(byte[] bytes, int desiredX, int desiredY)
{
BitmapImage image = null;
MemoryStream stream = null;
try
{
stream = new MemoryStream(bytes);
stream.Seek(0, SeekOrigin.Begin);
image = new BitmapImage();
image.BeginInit();
image.StreamSource = stream;
image.DecodePixelWidth = desiredX;
image.DecodePixelHeight = desiredY;
image.EndInit();
}
catch (Exception ex)
{
if (ex != null) {}
throw;
}
finally
{
stream.Close();
stream.Dispose();
}
return image;
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I rather suspect the problem is to do with the Decodes - try not setting them.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Well, removing those lines removed the exception, but the image doesn't display. :/
I set Image.Source to the retrieved BitmapImage , but I get nada on the screen. I verified that the BitmapImage object contains sane data (the DPI and resolution of the image are correct). What am I missing?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
This is absolute hell, in fact, I blogged about it. If your image control is inside a grid or not, can make a difference. Check my blog ( link below ) for more details, they escape me right now, but basically, I once spent a few hours trying to work out why my image was not shown, and the reason was the control kept a size of 0, which changed when I changed the parent control.
And I spent several hours today trying to make a BitmapImage load a bitmap to be the size it was on disc, all to no avail. I do know that if the DesiredXXX properties work at all, you should set one and it will use that one, and maintain the aspect ratio. You could try that.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Try using this method instead:
public static BitmapImage BitmapImageFromBytes(byte[] bytes)
{
BitmapImage image = null;
MemoryStream stream = null;
try {
stream = new MemoryStream(bytes);
stream.Seek(0, SeekOrigin.Begin);
System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
image = new BitmapImage();
image.BeginInit();
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
ms.Seek(0, SeekOrigin.Begin);
image.StreamSource = ms;
image.StreamSource.Seek(0, SeekOrigin.Begin);
image.EndInit();
}
catch (Exception ex)
{
if (ex != null)
{
}
throw;
}
finally {
stream.Close();
stream.Dispose();
}
return image;
} This requires you to import System.Drawing , but it does the job.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Worked like a champ. Many thanks.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
No probs mate.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
John Simmons / outlaw programmer wrote: image.DecodePixelWidth = desiredX;
image.DecodePixelHeight = desiredY;
image.EndInit();
I found out tonight that this is a waste of time. I spent ages trying to load an image to be the same size it was on disc, and while the PixelWidth and PixelHeight would be correct, nothing I did could get the actual Width and Height to be right. To be clear, I found it was next to impossible to take an 800x600 jpg on my hard drive, and load it in WPF to be 800 x 600 in size.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I think you mentioned it in another post, but it's due to the DPI and the way wpf displays images...
link[^]
|
|
|
|
|
Yeah,the whole DPI thing is an absolute nightmare. I tried to do something like what you linked to, but it was too complex in the context of our program, I couldn't get the image control to size how I wanted it to.
My main point was, I requested an image of a specific size and got something else back - the framework is just a nightmare in this regard.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all,
I am in the following situation: I am writing my own "application framework" *WOW* - just for myself, nothing generally interesting There I want to implement a base class for applications - lets call it AppBase which is derived from System.Windows.Application. A concrete WPF application is to use AppBase as base class for the partial class MyApp.App in the file App.XAML.cs.
Now when compiling a concrete WPF application a code generator transforms the XAML code of MyApp.App into c# and puts System.Windows.Application as base class for the generated part in App.g.cs.
This leads to the situation that the compiler complains that I am not to use different base classes for my partial class MyApp.App.
What I am wondering is: Is there a way to tell the code generator which base class to use?? Any other way to enable the specification of custom base classes for WPF applications is also wellcome.
Thanks in advance.
Lars
#pragma error( disable : * )
|
|
|
|
|
Hi,
I am working on a RSS feeds application using Silver light 2.0. In this I am using WPF service for solving the cross domain problem. But for this web service I have to use System.ServiceModel.Syndication namespace. For adding this to my application to my application I looked in Add reference --> .Net tabs but I cannot find it there.
Please reply me how can I add this to my application.
Thanks in Advance
|
|
|
|
|
You can't. Silverlight uses a separate set of Silverlight assemblies because these are the ones that are available at the client end as part of the Silverlight download. This means that you get a subset of WPF/.NET functionality.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
If you upgrade your application to Silverlight 3, the Syndication classes are there.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|