473,809 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic use of WPF datagrid

1 New Member
Hi.

I have the following scenario.

I have a WPF form with a datagrid on it
The datagrid is hook up using binding to a Qbservalcollect ion. The datagrid should be seen as a propertyeditor. Like the on in visual studio
1 Colum with the propertyname (this is read only)
1 Colum with the propertyvalue

The basic model for the collection is contaning.
Public PopertyName
Public PropertyValue.

This is quite simple and works fine, when passing data to the collection is gets populated in the view.

Now come the tricky part, in the viewmodel there is a eventhandler reacting on a message from another viewmodel.
I takes a propertyobject, the object can differ from message to message.
It is the eventhandles taks to translate the propertobject into something the can be shown in the data grid.

e.g.
a propertyobjec could look like this

id = 100
name = "Action1"
time1 = "1000"
time2 = "2000"
and so on.

This is stille quite ok to show in the data grid, BUT
some of the Values would be nice to show as preselected values in a combobox in the datagrid, but only some, and this differs from propertyobject to propertyobject

e.g.
in one message Value pair number 3 should be a combobox in the datagrid.
in another message it should be Value pair 5 7 8 the should be shown as combobox in the data grid.

As im using a MVVM approche this should be done using biding and some dynamic content template or something.

The question is how should this be done ?

Br.
Michael Rahr
Feb 17 '12 #1
0 1354

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1353
by: JP011 | last post by:
Hello I have hit a major road block when it comes to building my dynamic datagrid. To make a long story short I need a dynamic datagrid because my connection string could change and I need the datagrid to handle that. First I tried to create my datagrid by leaving the auto-generate columns equal to true. This worked fine except that when my user wants to edit a line I do not want them to edit column 1, only column 2. I could not find a...
0
1022
by: Karlo Swart via .NET 247 | last post by:
Hi. I am creating a dynamic datagrid. The columns are based on a request.querystring value. Eg: I will pass in a 'func=toys' parameter, which will cause the datagrid to load create columns specific to a toys xml file I pass in. I have a problem with the sort functionality. I have created the sorting command handler and this works fine when the columns are not created dynamically. I successfully create the columns for the datagrid in the...
1
2061
by: Mark | last post by:
Hello, I have a database which contains approximately 30 reference tables. I've been looking at building a dynamic datagrid that is updateable, but have run into problems with the Cancel and Update events not firing. After reading several posts about the events not firing, it seems that this may not be the best solution. What would be the best way to handle the updates of the 30 tables? Should I build one page with 30 datagrids and...
1
2014
by: Sudhir | last post by:
I have created a dynamic datagrid and would like to sort the grid when I click the column name in the header. ----------------------------------------------- Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) BindGrid("") End Sub Private Sub BindGrid(ByVal Sortfield As String)
1
1037
by: bshannon | last post by:
Can someone point me in a direction or show me an example of creating a dynamic datagrid. Based on a users input I would like to have the datagrid created progromatically if possible. There are 4 possible scenerios of which different data needs to be displayed from different tables. I have no problem creating datagrids using the GUI interface but am not sure how to start one dynamically. Otherwise my only option is to create all 4...
0
1707
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a single worksheet into a dataset. I successfully built a dynamic datagrid. And I did successfully bind it to the dataset. Then I added the datagrid control to a PlaceHolder. The first worksheet displays beautifully. The next step is to allow...
1
1838
by: benoit | last post by:
Hi, I created a Dynamic Datagrid and i added an EditCommandColumn to it. Works fine, but my Editcommand eventhandler seems to have a problem with PostBack This is my code private DataGrid GridDataLangs(DataTable vDataTable){ DataGrid myGrid = new DataGrid(); myGrid.AutoGenerateColumns = false;
7
1790
by: CanoeGuy | last post by:
I have been trying for the last two weeks to display a dynamic DataGrid. The data that I'm pulling from a SQL Server DB will have whole columns that will be either NULL or 0. I want to display only the fields that have actual data in them and either not display or hide the columns that have NULL or 0 values. As an example, one page may need to display a total of 5 columns and another page may need to display three columns based on the...
1
1177
by: RitaK | last post by:
Hi, I have a dynamic datagrid linking to an SQL Table which works fine. I now want the user to be able to click on a column header to selct the column(s) and at the same highlight the selected columns background color as in Excel. Have tried everything but just can't seem to get it right. Can any one help please. Thanks
0
2918
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string strDataValueField; string strDataTextField; public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.