|
Hi,
Kindly suggest me how to use a DP as ConverterParameter in Xaml.
Thnx,
Ritesh
|
|
|
|
|
Hi all.
When I open a new window from an Asynchronou CallBack Function, an Exception is thrown.
The Exception is "The calling thread must be STA, because many UI components require this wpf"
If I set ApartmentState of the thread to STA using the code Thread.CurrentThread.SetApartmentState(ApartmentState.STA) it is not working...showing an error Failed to set the specified COM apartment state.
How can I open a new window from different Thread, and modify the controls contents?
Please Help me to solve this problem...
Thanks in Advance
Vayanan
|
|
|
|
|
vayanan wrote: How can I open a new window from different Thread
You can't.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi All,
I've been using RoutedCommand for pretty much all my commanding needs in WPF so far, they are great. However, I have one architectural question.
I want to move a load of my command logic into a different assembly rather than just using a routed command to kick off logic via code in my window code behind I was to off load everything to the other assembly. The problem I have is getting some information from the UI. Say I have an export database to XML routed command the button is hooked up to command bindings in window.xaml. The routed command needs to have a file path and name to export too so if this routed command was in a namespace referenced BY the UI how would I communicate the result of a FileDialog to the routed command logic in the other assembly?
Are there any options other than having the FileDialog.show() in the window.xaml.cs in order to get a file path and name to save to and then kicking off the exporttoXML() method in the datalayer?
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer,
Can you reword the question and trim out the implementation details. Not sure exactly what you need to accomplish.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
Say I have a command binding in the UI Exe that kicks off command logic in my datalayer dll. This command also requires a file path + name variable to be passed to it. What's the best way to achieve this whilst keeping ALL the implementation in the datalayer dll (including Executed + CanExecute)?
Is that even possible? Do I have to keep some FileDialog.Show() logic in the UI exe?
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
If you want to pass additional information in the Command event args, then derive a class that has the data you need.
You'll need to write a custom command with custom command args. Very easy to do.
However...
Not sure what you are doing here. Typicaly, data layers don't handle Commands or UI interaction like FileDialog.Show. Maybe you want to handle the file selection in the UI and then call a method and pass it the file name?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Jammer - architecturally it's a very bad idea for you to want to put the FileDialog in anything other than the UI - this is where it belongs. Consider the case where you decide that you want to spread the load of your application, and you decide to move your datamodel code onto a server (with the FileDialog code being in the data model); at this point the file dialog will want to run on the server (where there will normally be nobody logged in).
Please rethink this - for your own sanity.
|
|
|
|
|
Thanks for the feedback peeps.
I'm just going a tad mental with the WPF DM-V-VM model that Dan Crevier talks about. Trying to get as much code out of my main window code behind.
Your both bang on the money, i'm being daft!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I met a problem,my customer feedback that they want the font a bit "bold",but when I changed the font to "Bold",they said that not what they really want. it really make me crazy,but it was what I have to face.
so does anyone have the experience to set the font a bit "bold"? maybe use some font brush...I don't know how to do it.
any suggestion,any idea are welcome!
Robin
|
|
|
|
|
That just sounds insane!!!
Personally this sounds like a red herring scenario. Maybe they are just explaining their point using the wrong language. Have you thought about showing them different options?? Different fonts?? Font sizes??
WPF allows you to embed fonts in applications so you aren't tied to just using system fonts, that said I haven't played with those settings at all. You also get into licencing issues when you start embedding other peoples assets in your application.
Anyway you can:
FontWeight="Medium"
FontWeight="SemiBold"
etc ...
The option that will actually have an effect will depend on the font you are using. Some of these settings with a lot of fonts (particularly system fonts) will have no effect ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I need a custom Canvas control with coordinate system centered in the middle of it and I still don't know, how to implement it using default WPF Canvas. I know, that there are some Transformations, that I can use, bud I didn't managed to use them for acquiring this goal.
All that I need is just Canvas and the ability to add dynamicaly objects like Ellipse, Polyline, etc., but the Left 0 Top 0 position should be in the middle.
Any idea?
|
|
|
|
|
|
Yeah, so I'm back again with a new question (yeah I'm learning WPF at the moment )
When I use a rotation transformation on an image and then save the image to file, the rotation isn't saved as part of the image. I know when we are talking about rotations other than 90 and 180 degrees there's the whole question of what to do, but even when using a rotation angle of 180 degrees it isn't actually saved in the bitmap itself.
In order to actually save such a transformation would I have to do all the dirty work myself, i.e. not using a rotation transformation but do the bit rearranging in code?
"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
|
|
|
|
|
Ok, so I discovered that some of the encoders (possibly all of them?), has a rotation property where I can specify whether a rotation should occur when saving the image. Still it only supports increments of 90 degrees which is inadequate for me, so I simply do the rotation manually.
"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
|
|
|
|
|
Hey. I need some help determining the image format of an, well, image.
I have a small WPF program where I can open and display images. I load a BitmapImage objec,t and display it on an Image control in a window, and that all works fine.
Now I would like to save the image when changes are done to it, and I would like to save it in the format which was originally opened. So if I opened a JPEG image I would like to encode the BitmapImageSource as an JPEG using the JpegBitmapEncoder and that's all nice and works.
But when I load the BitmapImage it automatically determines the decoder to use, and when it's time to save the image I can't find an easy way of determining which encoder to use. I guess I could save the file name when I open it, and the from that deduce the file type and from that the image type and from that the encoder to use. It just seems so messy. I kind hoped the BitmapSource would save this information in some metadata, but doesn't (or so it seems).
Any advice as how to easy determine what encoder to use? Did I miss some obvious approach?
"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
|
|
|
|
|
|
Hi Chandra,
No, I did actually find that page during my research. Believe my Google is my main research tool
My problem is that it seems kind of stupid that I would have to go through all that manually, when WPF does it as well since it decides on the correct decoder when I loads the image. I would just like to get to that information so I can easily decide on what encoder to use.
But thanks none the less.
"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
|
|
|
|
|
Rohde wrote: No, I did actually find that page during my research. Believe my Google is my main research tool
Hi
I wasn't trying to be a smartass - deciphering the header was what I had implemented in one my apps (though not WPF).
I am a complete ignoramus as regards WPF... If as you say WPF already does the decoding when loading the file, maybe there is a property that says what type of image it is? Or does the load image method return an image type?
|
|
|
|
|
Hi,
ChandraRam wrote: I wasn't trying to be a smartass
I know, I know. I didn't mean to imply that you were
ChandraRam wrote: If as you say WPF already does the decoding when loading the file, maybe there is a property that says what type of image it is?
You would think, but I just cannot find it. I will keep researching, I'm sure there's some logical way of doing it.
"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
|
|
|
|
|
This opens and saves a copy using the same format. I think decoder.CodecInfo has the info you need.
var uri = new Uri(@"C:\input.jpg");
BitmapDecoder decoder = BitmapDecoder.Create(uri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapEncoder enc = BitmapEncoder.Create(decoder.CodecInfo.ContainerFormat);
enc.Frames.Add(BitmapFrame.Create(decoder.Frames[0]));
enc.Save(new FileStream(@"C:\output.jpg",FileMode.Create));
|
|
|
|
|
Thank you Dave. That's exactly what I was looking for.
"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
modified on Thursday, May 29, 2008 1:49 PM
|
|
|
|
|
I want to start making my wpf user interfaces more interactive.
i am starting with a spring animation similar to
http://www.myphysicslab.com/spring2d.html
download my project: "FirstAnimation" here:
http://files.mixhacks.com/FirstAnimation.zip[^]
There are 3 attempts in the project:
1) is based off RungeKutta4 class found in "Practical WPF Graphics Programming by Jack Xu" ...
i'm missing something which after days of reading and hours of troubleshooting i haven't been able to fix.... anyone?
2) is an attempt to create my own solution using something i can more easily digest... vectors.
however again it has a problem. It does oscillate but .... take a look
note: it uses the vector3 class found here on codeproject.
3) the last one works .. which is based off Keith Peters flash book.... although the animation looks good its not real physics.... Foundation Actionscript 3.0 Animation: Making Things Move!
it doesn't compare to the 2d spring example above.
I'm posting this here in hopes that someone can shed some light to a newbie in animation and game programming with wpf.
Lastly....
are there any wpf projects attempting to bring compiz to normal devs?
http://compiz.org/Home/Screenshots
to normal devs in wpf?
http://www.youtube.com/watch?v=wOPOXSoArWQ
http://news.opensuse.org/2007/09/04/sneak-peeks-at-opensuse-103-compiz-and-compiz-fusion/
http://en.opensuse.org/Compiz_Fusion - see the alternative projects section for projects similar to compiz
|
|
|
|
|
|
Hi,
I would like to ask anyone have any ideas how to create own set of tool palette such as pen tool,brushes using Silverlight?
Thx.
Regards,
Katelva
|
|
|
|