|
Ugh. And the lookup VM would have to contain a collection of single VMs?
e.g.
PeopleVM
contains collection of
PersonVMs
And I would do this for everything I want to lookup?
|
|
|
|
|
It's the way I like to use it. It keeps everything nice and compact - and easy to test.
|
|
|
|
|
Hello sir
Now I am working on wpf. I am facing a problem. I used dynamic tab. In dynamic tab have N number of controls. These controls are dynamic. I used basically 3 type of control.
1) Label
2) Text box
3) Mask Text box.
When I move the scrollbar then mask text box is moving out of tab control. In case of other controls are working fine.
I am using in xaml code.
1) ScrollViewer (In scrollview use)
2) Grid (In grid use tab control)
3) Tabcontrol (In tab control have dynamice controls i.e. MaskText box, Lable,Textbox
So kindly tell me the solution. To solve this problem.
Thanks
Asit Sinha
Asit Sinha
|
|
|
|
|
Asit Kumar Sinha wrote: When I move the scrollbar then mask text box is moving out of tab control. In case of other controls are working fine.
Assuming you're referring to the scrollbar provided by the
ScrollViewer, the entire Grid and its contents should scroll.
Asit Kumar Sinha wrote: So kindly tell me the solution.
Kindly provide a working XAML example that demonstrates the problem...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
So, as many of you probably have, I saw Billy Hollis' demo of his StaffLynx application and was enamoured by its "pseudo-web2.0" design. Having student versions of Visual Studio 2008 and the Expression Studio, I sought to do some of the neat stylings that he did. However, I just don't know how he got his windows styled like this:
http://blogs.msdn.com/blogfiles/shanemo/WindowsLiveWriter/BillyHollisonGettingSmartwithWPF_FB8C/image_2.png[^]
I tried creating a stack panel with a border, then having grids within that, but I can't seem to get the sizing and styling correct. If anyone could point me to a resource with the right "best practices" for this sort of thing, or could show me a demo of similar capabilties, I would be most grateful.
As I see it, its like this:
Bordered Stack Panel
|--Grid with title text
|--Grid with search bar
|--Stack Panel
|--Grid with custom listbox (left)
|--Grid with custom listbox (right)
|--Footer
Thoughts?
|
|
|
|
|
pancakesOfMassDeliciousness wrote: Thoughts?
Yes, two.
1) Your username rocks!
2) Your visual tree outline looks like a good start to me.
Which elements are you having trouble sizing?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
StackPanels cause people a lot of trouble. They only stretch to fill the screen one way, depending on the Orientation. I might do something more like this:
<DockPanel>
<TitleStuff DockPanel.Dock="Top" />
<!-- put buttons in this panel -->
<!-- or possibly a grid with two rows,
one image, one text -->
<StackPanel DockPanel.Dock="Bottom"
Orientation="Horizontal"
HorizontalAlignment="Center" />
<DockPanel Margin="???">
<SubTitle DockPanel.Dock="Top" />
<SearchBar DockPanel.Dock="Top" />
<Add/Edit/Delete DockPanel.Dock="Bottom" />
<Grid>
<!-- rest of stuff here, probably 2 columns,
3 rows. left list box spans bottom two rows -->
</Grid>
</DockPanel>
</DockPanel>
|
|
|
|
|
Hello,
Resurecting an old post here, but did you manage to build that kind of shape or at least find any valid source of information.
I would be pretty interested too.
Thanks in advance for your answer.
Seb
|
|
|
|
|
Nah, never found much of anything.
In the end, I had to concentrate on working on the back-end of my project (Db, services, etc.) and have not yet gotten to the point where I even need to worry about WPF...
If you come across anything, please keep me posted as well.
BTW -- The actual StaffLynx app that Billy Hollis created can be purchased now. Wow: http://www.sommet.com/technology_stafflynx.php[^]
|
|
|
|
|
Thanks for the quick answer.
I think I'll try doing something myself because I didn't manage to find some valid information source.
I'll keep you posted.
Seb
|
|
|
|
|
Why WPF
To build Desktop applications, Microsoft came up with numerous APIs over the years, like Win32 API, MFC, VB 6.0 and lately .NET Winform.
Typically in a full fledged desktop application, you would like to have diverse User interfaces like controls, 2D Graphics, 3D-Graphics and may be optionally (say by clicking on Advanced.. button) you want to have Media and Animation.
Looking at above APIs from Microsoft, It is difficult for a Windows Programmer to master diverse nature of each API for a particular User interface.
Apart from this, in all above technologies more or less the overall Layout was fixed. In other words, Layout couldn't adapt itself easily to different window sizes.
Finally, In all above technologies, there is no way to separate the Graphical contents from code. Say e.g in WinForm Apps, when you drag and drop a control on a form surface framework generates C# code. It also means that to change the look and feel of any control you will have to deal with code.
This is where Microsoft came up with 'Windows Presentation Foundation' (WPF)
Windows Presentation Foundation is a one of the .NET components which allows you to develop the Next Generation Desktop Application with very rich user interfaces.
WPF is available from .NET 3.0 onwards. It is one of the components of .NET 3.0 and .NET 3.5 frameworks
-------------------------------------------------------------------------------------------------
WPF Features:
1) Single Unified programming Model for different User Interfaces like 2D Graphics, 3D Graphics, Media, Document API and Animation
2) Declarative User interface through XAML
3) Separation of Business logic from UI part through *XAML
4) Flexible Layout Model (no use of coordinates of control w.r.t to window)
5) Lookless controls (without fixed size)
6) Enhanced Designer and Developer productivity. Designer can work on UI aspect through *XAML file and developer would be busy with corresponding .cs file
7) Powerful data binding model
8) Hardware acceleration. WPF drawing is performed through DirectX.
---------------------------------------------------------------------------------------------------
WPF's basic programming Infrastructure
-> Declarative programming Style using *XAML (Using XAML is optional)
-> Dependency Properties wrapped under normal .NET properties
-> Routed Events
-> Control Commands
---------------------------------------------------------------------------------------------------
*XAML (Zammel) is XML based markup language to instantiate .NET objects
XAML tags are mapped with .net classes, XAML file is compiled into *BAML
BAML is tokenized binary form of XAML and .NET objects are created using this BAML
BAML enhances performance as compare to creating .NET objects through raw parsing of uncompiled XAML file.
---------------------------------------------------------------------------------
Flavors of WPF applications
1) Traditional Desktop Application
2) Navigation based WPF Application - for light weight desktop app
3) XAML browser Application (XBAP) - natively hosted by browser
Now you have correct perspective, programming WPF is the next natural step.
|
|
|
|
|
Errm. Thank you?
I already know this though - perhaps you might want to put it on a blog somewhere, rather than in a forum.
"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
|
|
|
|
|
amazing list of features that were never pain points
|
|
|
|
|
Hi,
How can I open & run my WPF window from a Windows Form?
I created a WPF application project with a Window named "MyWindow".
I also created a Windows Form named "MyForm" in the same project.
Now, from the App.xaml.cs, I am opening MyForm, where one button is there.
On click of that button, my WPF Window should open.
I used the following code:
<br />
MyWindow w = new MyWindow();<br />
w.Show();<br />
So, now on click of the button, WPF window is opening fine.
But, the problem is, when I am closing my WPF Window, the Form is also closing & exiting the application.
How can I solve this problem? My application should not close until I close my Windows Form. Please help...............
|
|
|
|
|
We really need to see how you've opened the form from App.Xaml before we can comment. Basically, we need to see if the form is running as part of the application message pump.
BTW - this is a really strange architecture. Why are you doing this?
"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
|
|
|
|
|
It sounds like the WinForm is stealing the events (even though it's not the active window).
"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
|
|
|
|
|
Set Application.ShutdownMode property to ShutdownMode.OnExplicitShutdown. In WPF, OnMainWindowClose is the default ShutdownMode. The WPF window you open becomes the main window. So closing that window causes the wpf app to shut down unless you explicitly set a different window as main.
|
|
|
|
|
I've noticed a lot of posts on various blogs, etc about this error when referencing image files. Apparently it means that Silverlight can't find your file, or Silverlight doesn't support the format (.gif).
I think like most people experimenting with Silverlight, I haven't formally studied the language, and so I miss many nuances. Here is one where I'm sure it is documented somewhere but I had to learn the hard way.
I had a situation where I was loading an array of image names to be used as a series of ImageBrush elements, so I added the image files to the Properties folder through Blend, and reference them in my code-behind, as...
"Properties/MyImage.png"
however Silverlight didn't recognize them. I had other images referenced the same way in the XAML code and Silverlight had no problem.
It turns out that if you reference an image file (or I assume any other Resource) in the XMAL, Silverlight compiles the Resource into the App.DLL. If they are only referenced in the code-behind this is not the case, so you must include a copy of the Properties folder relative to where the XAP file is run; in this case off my Bin directory.
Hopefully this post will help others avoid my time consuming mistake,
Steve
|
|
|
|
|
If you have static images to embed in your Silverlight app, you can just add
them to your project and set the Build Action property of the image to "Resource".
So, for example, if you add a folder to your project called Images, and add an
image to that folder called Test1.png, you can access it like this:
<!-- From XAML -->
<Image Source="Images/Test1.png" Stretch="None" />
BitmapImage bmp = new BitmapImage(new Uri("yourappmodulename;component/Images/Test1.png", UriKind.Relative));
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
I appreciate your reply.
Yes my images are marked with the Resource Build Action. Even if I add the yourappmodulename;component/ to the image file string, I still have no luck. With or without yourappmodulename;component/ being added to the string, it appears to create a valid BitmapImage (at least as far as I can see by examining the object in the watch window), but when it comes time to display it, I still get the same error in a Webpage Error messagebox.
If I reference the same image files from XAML, then they are there for the code-behind as well. When I remove the XAML references, the error returns.
The only way I have found to prevent this without adding superfluous references in the XAML, is by including the actual images as I indicated in my original post (although they are actually included relative to Bin/Debug, not Bin; i.e. Bin/Debug/Properties).
I'm not sure what else I am doing or not doing that prevents your solution from working for me.
Thanks again for the response,
Steve
|
|
|
|
|
Just so I'm clear, you want embedded images in your app module, right?
Or are the images external resources?
If you are embedding images in the module:
How are you adding images to your project?
I can't add anything to the "Properties" folder in my projects...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'd like them to be embedded, but other than using XAML references, I can't seem to force them to be. I added the image files to the Properties folder through Expression Blend.
Thanks,
Steve
|
|
|
|
|
SBJ wrote: I added the image files to the Properties folder through Expression Blend.
Interesting....that may be the problem.
For project management, I would highly recommend using Visual Studio.
For packaging images with your app, using VS Solution Explorer, you can
1) Create a folder in the project (or use the project's root folder if
you want - messier IMO)
2) Right click the folder, choose Add/Existing Item... and add the images.
By default, the image's build action will be set to Resource - this will embed the
image(s) in the assembly DLL.
At this point you have options -
1) The default (as mentioned above) packages the image(s) in the assembly DLL.
2) You could change the image build type(s) to "Content" and the image(s) will be placed
in the app's XAP file, separate from the DLL.
3) You could change the build type to "None", set the Copy to Output setting to copy always
or copy if newer, and the image(s) will be left on the server -
accessible using a URL. You would use this option for loading on demand
instead of having the image(s) download with the XAP file at startup.
This link shows all these options: Different ways for loading images and files in Silverlight 2 applications[^]
That gives you control over how your images are included with the resulting application
package, so you don't have to guess or rely on some implicit packaging of the images
just because you referenced the image in XAML somewhere
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually this project originated in Blend and was first loaded into VS through the Edit in VS menu command in Blend. When I right-click on the Properties folder in VS the only option I have is to Open it. All the other folders include the menu options you would expect. I think you may be right about Blend causing the problem. I can add that to the numerous other problems encountered when developing using the two packages together. Hopefully, VS 2010 and Blend 3 will be more stable!
Thanks again for your help,
Steve
|
|
|
|
|
SBJ wrote: Hopefully, VS 2010 and Blend 3 will be more stable!
Indeed! I was going to say the same thing.
I struggled using the two together at first and found it's best to do project
creation and housekeeping with VS and use Blend just for the stuff it's good at.
At least until they are 100% interchangeable with their project handling...
Also, the latest service packs for both products fixed some of the issues I dealt
with at first, so I'd definitely make sure to keep up-to-date on those
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|