Trying to create what i feel should be an easy WPF application. basically what i want it to do is have a autocomplete combobox which is bound to a sql db table. the table has 2 fields(Address and Directions)
once the user selects the record from the address combox the directions textbox below will be filled directions stored in the table.
if there are no records in the address combobox the user can then type in the combobox and add the new entry.
there will be a save button on the form that saves the new entry and will be visible in the list. Im new to WPF applications and have been trying to get this to work for weeks. Any help would be appreciated.
I would start by checking out the following discussion which will point you to several good tutorials on using the MVVM (Model-View-ViewModel) pattern with WPF.
MVVM: Tutorial from start to finish?
Other than that, you haven't really given any indication what you've tried and what isn't working so I can't really offer any other advice. But even the simplest applications in WPF are much cleaner and more easily implemented with MVVM than using code behind and drag and drop data binding.
Related
How do I transfer data from one window to another modal in silverlight. I have one window, push the button and another window appears where complements sample text boxes, data from these fields I would like to have seen in the previous window.
The answer depends on what type of framework you're using. In caliburn micro with a viewmodel first approach these types of things are very simple. You just create a new viewmodel and set the proper fields and let caliburn handle displaying it for you. With other view first approaches it is more difficult. You can maybe use a Message to set the fields using something like MVVM Light. Either way we need more information on how you are building your app to answer your question.
I have worked in ASP.net before and know that I can edit its equivalent to a datagrid (detail view or something like that?) However, I'm working on a windows form now and i need to use the datagrid. I know there are options to edit each individual cell and when I ran my program, it edited it, but it does not update to the database. I was wondering how I would be able to write a SQL code using ADO.net for the datagrid so I can update certain things (or I can bind the datagrid but maybe there is a build in edit command) thanks!
Databinding is significantly different in WinForms than it is in ASP.NET. There's no request cycle and databinding is always both ways (controls read data from the datasource and automatically update it as well).
However you'll still need to take the data from your datasource and persist it to the database. How you do that depends on what your datagrid is bound to.
I recommend you review this MSDN article Windows Forms Data Binding and the links that matter to you
am a newbie in the WPF and more so the WPF Datagrid arena. Am so used to working with the cousin -- DatagridView from Windows Forms, but it's my first time working with WPF's Datagrid Control, and am having a very hard time!
I have created a dataset using the in-built datasource wizard in Vidual Studio 2010. After creating this dataset, I used another in-built feature that allows me to auto-generate a datagrid that is pre-bound to this a table in the dataset, so I can just drop it onto the window.
Now, all that is done nicely, til I come to the part where I need to have the user edit the contents of the datagrid, and via a callback, have the new / updated data committed to the underlying table in the database.
I've tried searching around, but most articles are out-dated, and some don't hit the problem in ways that make sense to a newbie like me.
One source says:
DataGrid checks for
IEditableCollectionView’s CanAddNew,
CanCancelEdit, and CanRemove
properties before executing the
EditItem, CancelEdit, or CommitEdit
methods. So if editing appears to not
work for some reason, be sure to check
that it is able to edit.
from an MSDN source, but the Auto-generation feature of Visual Studio 11 gives me this for the data-binding source
<Window.Resources>
<my:crimexDataSet x:Key="crimexDataSet" />
<CollectionViewSource x:Key="datapoolViewSource" Source="{Binding Path=datapool, Source={StaticResource crimexDataSet}}" />
</Window.Resources>
So, how do I move from this to an IEditableCollectionView kind datasource, so I can have editing enabled? Thanks in advance...
If this isn't an application with a short lifetime, I would save myself a lot of pain and learn about the MVVM (Model-View-ViewModel) pattern. It is a very common pattern in the WPF and Silverlight worlds.
Basically, you would make a class specifically designed to be the data source for the grid, and perhaps other data you would need in your window.
For this particular need, you would probably use an ObservableCollection as the type of the property bound to the grid.
There is a lot of information on MVVM here at StackOverflow, to be found on Google, and in books. If you grok the pattern, it can really make the UI development experience a lot less painful.
I am new to Silverlight. How would I go about creating a control for users to tag content.
I would like it to work like it does it StackOverflow i.e. Autocomplete and when you press space it inserts the tag in a box with a remove button. I want the control to be bindable to a collection of strings.
If someone can just point me in the right direction to get me started I would be very grateful.
You need to start with an AutoComplete Textbox, there is already one available in the Silverlight Toolkit. Tim Heuer has several examples using it (he actually creates one himself in one of his posts somewhere), you can find one sample here. Once you have this in place, the rest of the control is pretty simple.
I'm designing data-oriented application in Silverlight 3 and I'm wondering if is it worth using new DataForm control. It looks really awesome on PowerPoint slides but I have no idea how it is in real life.
I need to achieve following behaviours:
group model's fields to areas, for instance separating groups using horizontal lines or naming group of fields,
place 2 or 3 input controls in exactly one row, for example: country-dropdown, zip textbox and city textbox,
multilingual validation errors,
a few readonly fields in edit mode,
posibility to hide fields in dataforms,
displying a helper button for showing modal popup window with dictionary/grid view.
I'd like to build it using Prism and RIA services.
Has anybody any experience to share?
I have tried using the DataForm in a couple of places in my current project. Spent several days tweaking the various properties and attributes on my classes and found that it never did quite work the way I wanted it to. The demos that are on the web look great but they don't have 'real world' scenarios and are incomplete. So, I wouldn't recomend the DataForm for complex scenarios.
My favourite feature of the DataForm control is that it works "out of the box". That is, you can plug one on your user interface, bind it to your data classes, and have it working with a minimal amount of code. Of course you need to further tune both the behavior and the appearance of the form (by using attributes on the data classes and/or properties on the form control itself), but for feasibility studies or for early usage testing it is usually enough (and very useful) to have it working quickly with the default behavior.
By the way this is a good resource to get started with the DataForm: http://www.silverlightshow.net/items/Creating-Rich-Data-Forms-in-Silverlight-3-Introduction.aspx