|
Thanks Patrick. My former employer deleted my blog when I left . I've been meaning to update this article with links to new versions of the blog posts, but some of them are lost forever. Eventually I'll figure out what to do about this...
:josh:
My WPF Blog[ ^]
Without a strive for perfection I would be terribly bored.
|
|
|
|
|
No problem Josh. Turned out what I needed to do was simpler than I thought. Good luck figuring out what to do about those blog posts
|
|
|
|
|
Use archive.org
|
|
|
|
|
Wow!! I never knew such a service existed! archive.org is amazing.
Thanks a lot!!
:josh:
My WPF Blog[ ^]
Without a strive for perfection I would be terribly bored.
|
|
|
|
|
Hi Josh,
I'm new on WPF
Recently I made a decision to develope an application which involves 3D visualization. I want to know is it easy to use 3D capability of WPF rather than using Direct3D?
You know, I want to create some simple 3D shape taking advantage of light and camera.
Thank you in advance.
|
|
|
|
|
Majid Shahabfar wrote: Recently I made a decision to develope an application which involves 3D visualization. I want to know is it easy to use 3D capability of WPF rather than using Direct3D?
I don't know, I've never used Direct3D or done any serious WPF 3D programming.
:josh:
My WPF Blog[ ^]
The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)
|
|
|
|
|
Hi Josh
I'm still big on a Wpf.JoshSmith.BreadCrumb[^] control. That would rock.
I've got another idea for the Wpf.JoshSmith library: Wpf.JoshSmith.TaskDialog[^].
Built with WPF, we could make one that works on XP as well as Vista, whereas the Vista TaskDialog common control works only on Vista.
What do you think? Seems like it wouldn't be too difficult to build such a dialog.
|
|
|
|
|
Judah Himango wrote: Seems like it wouldn't be too difficult to build such a dialog.
Thanks for the suggestion. Difficulty is not necessarily a prohibitive factor, time is. I'm interested in the BreadCrumb control idea that you posted a while ago, it just hasn't made it to the top of my todo list yet.
:josh:
My WPF Blog[ ^]
Enjoy! Vote! Learn! Love! Save the whales! Eat raw diamonds! Do the Foxtrot in your tighty-whiteys! Start fires! Kill Martians!
|
|
|
|
|
I just need to learn to write WPF stuff; I could then write the damn thing myself instead of complaining to WPF god Josh Smith.
I've tinkered with WPF a bit...I was able to modify the WPF RichTextBox to automatically underline hyperlinks. I've played with some of the various WPF document classes as well, but that's the extent of my experience.
One thing that is discouraging me from learning WPF further is the tools. I'm using Cider to play with WPF in VS, and jeez, Cider is hardly alpha quality. Makes me run back to the functional WinForms designer. :p
By the way, Josh, how are you cooking up your XAML? Is that done with Cider? By hand?
|
|
|
|
|
Judah Himango wrote: By the way, Josh, how are you cooking up your XAML? Is that done with Cider? By hand?
I do almost all of my XAML writing by hand. The only thing that I've used Blend for is creating intricate Path objects, the kind of stuff that typing by hand would be impractical. I like hand-coding my XAML because it promotes learning and exploration.
:josh:
My WPF Blog[ ^]
Enjoy! Vote! Learn! Love! Save the whales! Eat raw diamonds! Do the Foxtrot in your tighty-whiteys! Start fires! Kill Martians!
|
|
|
|
|
Ok Josh, since you seem to be the resident WPF expert and I've just last night installed .NET 3.0, Expression Blend, and the Cider addin for VS2005..
Where do you recommend I go to start learning about all this? I tried making even a very simple app using these new tools and failed miserably - the development architecture and paradigms are just too different from .NET 2.0 (now, mind you, I've been programming in .NET for quite some time so I'm very familiar with the technology).
Maybe I'm just feeling a bit overwhelmed because it's all so new..
For example, I look at this example: Creating the Glass Button[^]
And I wonder how anyone could have even begun such a project. Nothing in that button uses the visual designer, it apparently is all Expression Blend.
Anyway, I ramble, but good tutorials on the technology (and that reveal how powerful XAML apparently really is - it looks like the designer is just an afterthought, now) would be wonderful...
|
|
|
|
|
Patrick Sears wrote: Where do you recommend I go to start learning about all this?
That's a really tough question. WPF is huge, huge, huge. What do you want to be able to do with WPF? Make line-of-business apps? Make 3D visualizations of molecular structures? Create an animated board game with skinnable pieces and slick visual effects? Build a high-fidelity document viewing application? All of the above? None of the above?
Based on what you are looking to create, I would suggest different sources of learning material.
I realize that so far my answer has not answered anything, so let me take a step back and give some general tips and links...
NetFx3[^] is a great place to see all kinds of projects, article links, blogs, etc about .NET 3.0 (including WPF).
NetFxGuide[^] is really good too.
A while back I blogged about how to get started with WPF. Check it here[^].
I've posted quite a few WPF articles here on CP: Clickety[^].
Lastly, I highly suggest reading Adam Nathan's book 'WPF Unleashed.' Here's why...[^]
HTH
:josh:
My WPF Blog[ ^]
Don't you wish your girlfriend was hot like me?
|
|
|
|
|
Josh Smith wrote: WPF is huge, huge, huge.
Boy, you ain't kidding.
Josh Smith wrote: What do you want to be able to do with WPF?
Well, at the moment my attention is drawn most to the custom templating you're apparently able to do with the controls. Your custom TreeView was quite impressive, the ListView drag drop manager, and the sliding list box.. all quite impressive. So I think for the moment, what I'm looking for is 'skinnable and slick visual effects.' Shallow, I know, but I develop user apps and that's all users care about.. hehe.
Thanks for the 'clicketies'. I'll be buried in them for awhile..
|
|
|
|
|
Question:
In your intro to WPF, you state:[^]
"Another benefit of using vector graphics is it works well with high-resolution displays; something which is becoming a problem for the antiquated HWND technology as the resolution of display units improves."
I read something to the same effect on another blog, basically that WPF is not HWND based. What is the basis for this statement? Windows (Vista included) itself is still HWND based, is it not? How can the operating system fundamentally render a window without an HWND?
|
|
|
|
|
|
If you're still interested in learning material for WPF, I've been writing a series of introductory WPF articles here on CodeProject. You can view the Table of Contents here[^].
:josh:
My WPF Blog[ ^]
Enjoy! Vote! Learn! Love! Save the whales! Eat raw diamonds! Do the Foxtrot in your tighty-whiteys! Start fires! Kill Martians!
|
|
|
|
|
Hehe. I've been following them!
I've downloaded the Orcas CTP but haven't found time to install it yet. I've also noticed some syntactical differences between the XAML supported by the Visual Studio 2005 plugins and Orcas itself - some XAML tags are not supported in the VS2005 plugins.
I haven't said anything yet because I need to install Orcas to get a real picture of which are and are not supported so I can let you know.
|
|
|
|
|
Hello Josh,
I have tried attaching a scrollviewer to your dragcanvas so that I can get horizontal and vertical scroll bars when the object being dragged goes outside the canvas boundary. But it doesnt seem to work..Any thoughts. I replaced the base class of DragCanvas from Canvas to InkCanvas..I get the scrollbar/scrollviewer ,then..Should I do this..Is it a good approach..if I can set the EditingMode to None. Will this work? I am desperately seeking the scroll viewer functionality on this.
|
|
|
|
|
wrote: I have tried attaching a scrollviewer to your dragcanvas so that I can get horizontal and vertical scroll bars when the object being dragged goes outside the canvas boundary. But it doesnt seem to work
It doesn't work with the regular Canvas, either. It's not an issue specific to the DragCanvas. I've never tried too hard to make it work, but I know what you're talking about.
wrote: I replaced the base class of DragCanvas from Canvas to InkCanvas..I get the scrollbar/scrollviewer ,then
That's because InkCanvas is not a Canvas, or Panel, at all! It is a FrameworkElement which hosts an ink-enabled panel within it.
wrote: Should I do this..Is it a good approach..if I can set the EditingMode to None. Will this work?
I don't see any problem with it in general.
|
|
|
|
|
Hello Josh,
Thanks for your reply!
But I desperately need this Scrollviewer functionality on a canvas. Is there a smart way (without too much of coding) to achieve this on Canvas or your Drag canvas. Is it possible? If I inherit the Drag canvas from Inkcanvas, I do get auto scroll bars, but it seems to interfere with the 'drag' functionality of Drag canvas.
Do you recommend (if at all it works...) inheriting DragCanvas from the InkCanvas, if I were doing it JUST for the sake of ScrollViewer functionality because I am happy with the functionality drag canvas provides?
Can I somehow bind the Height and Width of the Canvas to the farthest edge of the farthest child element..by enumerating them or querying some container in the logical tree that has the co-ordinates of the whole occupied area by the child element(s) of the canvas..in a smart way?
Please suggest.
Thanks for all the Help and a superb Dragcanvas..!!
Thanks,
Niru.
-- modified at 4:46 Monday 12th March, 2007
|
|
|
|
|
All of my controls in the dragCanvas have a Selected and UnSelected appearance. I want to be able to click on the dragcanvas so the currently selected object will become unselected resulting in none of the objects having a selected appearance. Is there anyway to trap a mouseup event on the dragcanvas so I could fire a custom event allowing me to run the code I need to?
|
|
|
|
|
Hook the DragCanvas's PreviewMouseUp event and perform your selection logic there. You might want to use the DragCanvas's FindCanvasChild method to walk from the e.OriginalSource to the direct child element of the canvas.
|
|
|
|
|
Thanks Josh.
I’m not sure what you mean by “Hook the DragCanvas's PreviewMouseUp event”. You have the following overrived which fires when I click on an object in the canvas, but not when I click on the canvas itself:
protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
{
base.OnPreviewMouseUp(e);
if (isDragStarting)
{
// Raise event to any conumer interested in knowing that the drag is stopping
EndDragEvent();
}
// Reset the field whether the left or right mouse button was
// released, in case a context menu was opened on the drag element.
this.ElementBeingDragged = null;
}
I Added this event handler which also doesn’t fire when clicking on the canvus, but does fire when clicking on an object in the canvas:
public DragCanvas()
{
this.PreviewMouseUp += new MouseButtonEventHandler(TestOnMouseUp);
}
void TestOnMouseUp(object sender, MouseButtonEventArgs e)
{
Console.WriteLine(sender.ToString());
}
How can I get code to execute when the user clicks and open-empty space in the canvas (clicks on the canvas)?
|
|
|
|
|
Moondaddy,
The problem is that by default the Canvas's Background property is null. An element with a null Background does not participate in the mouse input event system. Set the DragCanvas's Background to, perhaps, Brushes.Transparent and then it will raise the PreviewMouseUp event as expected.
|
|
|
|
|
Hi all,
as I already stated I love your lib!
But now, I got a problem using the CenteredContentControl: I tried to adapt your XAML example to C#:
Line connectorLine = new Line();
connectorLine.Stroke = Brushes.Red;
connectorLine.StrokeThickness = 3;
CenteredContentControl ccc1 = new CenteredContentControl();
ccc1.Content = rect_top;
CenteredContentControl ccc2 = new CenteredContentControl();
ccc2.Content = rect_bottom;
Binding bind1 = new Binding();
bind1.Source = ccc1;
Binding bind2 = new Binding();
bind2.Source = ccc2;
connectorLine.SetBinding(Line.X1Property, bind1.Source.ToString());
connectorLine.SetBinding(Line.Y1Property, bind1.Source.ToString());
connectorLine.SetBinding(Line.X2Property, bind2.Source.ToString());
connectorLine.SetBinding(Line.Y2Property, bind2.Source.ToString());
DragCanvas.Children.Add(connectorLine);
DragCanvas.BringToFront(connectorLine);
The elements rect_top and rect_bottom are children of two DragCanvas elements which are children of one DragCanvas element in the main window. When I assign the content to the first CenteredContentControl ccc1, I get an error in the method OnPropertyChanged() during the 4th (?!) call of base.OnPropertyChanged(e);.
Do you know what's wrong here?
Thanks for your help...!
|
|
|
|