DataGrid binding with comumns of column ItemSource
<DataGrid Grid.Column="1" Name="grid2" DataContext="{Binding SelectedPage}"
ItemsSource="{Binding Params}"
AutoGenerateColumns="False" Grid.RowSpan="2">
<DataGrid.Columns>
<DataGridComboBoxColumn ItemsSource="{Binding Source={StaticResource xKeySource}}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectedValueBinding="{Binding Name}"/>
<DataGridTextColumn Header="ParamName" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Address" Binding="{Binding Address}"/>
<DataGridTextColumn Header="Format" Binding="{Binding Format}"/>
<DataGridTextColumn Header="Description" Binding="{Binding Description}"/>
</DataGrid.Columns>
</DataGrid>
Is it possible when I select from my ComboBoxColumn, compile automatically other columns in my DataGrid ?
The name of fileds in ItemSource are the same of name of another binding columns (are two different list but the property name is equal).
thanks
I don't follow what you mean
compile automatically other columns in my DataGrid
If you mean change the content of other fields in the same row then yes.
If there is a viewmodel per row you could act in the setter of the property of that which the combo is bound to. Set those properties in the viewmodel and if it implements inotifypropertychanged then they would change in the view.
In your markup
<DataGridComboBoxColumn ItemsSource="{Binding Source={StaticResource xKeySource}}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectedValueBinding="{Binding Name}"/>
<DataGridTextColumn Header="ParamName" Binding="{Binding Name}"/>
These are both bound to the same property though.
You combo is in the datacontext the row is in.
That Name property is the same as the Name property the other column would be in.
Select combo > Name
Enter in ParamName > Name
Both the same property.
Making it a property of something else would be very strange - which row is pointing at what.
Hope that helps.
Technet articles: Uneventful MVVM;
All my Technet Articles
Similar Messages
-
DataGrid itemrenderer with switch statement
Hi,
I have datagrid control with this columns
<mx:DataGrid id="dgvParagraphs" >
<mx:columns>
<mx:DataGridColumn dataField="type" headerText="Type"/>
<mx:DataGridColumn dataField="title" headerText="Title"/>
<mx:DataGridColumn dataField="content" visible="false"/>
</mx:columns>
</mx:DataGrid>
Under type column I have values from 1 to 6. Each number presents type of content. I have icons for each type. I would like to show icon instead of just number. I know this can be done using itemrenderes but I don't know how to accomplish this.If this post answers your question or helps, please mark it as such.
Greg Lafrance
www.ChikaraDev.com
Flex Development and Support Services
You might see issues with this code during scrolling, as DataGrid recycles itemRenderers, but in that case the icon information must be in the data.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public function getImageSource(item:Object):String{
var retVal:String;
switch(uint(item.type)){
case 1:
retVal = "black.png";
break;
case 2:
retVal = "blue.png";
break;
case 3:
retVal = "gray.png";
break;
case 4:
retVal = "green.png";
break;
case 5:
retVal = "purple.png";
break;
case 6:
retVal = "red.png";
break;
trace(retVal);
return retVal;
]]>
</mx:Script>
<mx:DataGrid id="dgvParagraphs" dataProvider="{dataXML..item}">
<mx:columns>
<mx:DataGridColumn dataField="type" headerText="Type" width="50">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="{outerDocument.getImageSource(data)}" horizontalAlign="center"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="title" headerText="Title" width="100"/>
<mx:DataGridColumn dataField="content" visible="false"/>
</mx:columns>
</mx:DataGrid>
<mx:XML id="dataXML" xmlns="">
<data>
<item>
<type>2</type>
<title>My Title 1</title>
<content>Content 1</content>
</item>
<item>
<type>5</type>
<title>My Title 2</title>
<content>Content 2</content>
</item>
<item>
<type>3</type>
<title>My Title 3</title>
<content>Content 3</content>
</item>
<item>
<type>1</type>
<title>My Title 4</title>
<content>Content 4</content>
</item>
<item>
<type>4</type>
<title>My Title 5</title>
<content>Content 5</content>
</item>
<item>
<type>6</type>
<title>My Title 6</title>
<content>Content 6</content>
</item>
<item>
<type>2</type>
<title>My Title 7</title>
<content>Content 7</content>
</item>
<item>
<type>1</type>
<title>My Title 8</title>
<content>Content 8</content>
</item>
<item>
<type>4</type>
<title>My Title 9</title>
<content>Content 9</content>
</item>
<item>
<type>5</type>
<title>My Title 10</title>
<content>Content 10</content>
</item>
<item>
<type>2</type>
<title>My Title 11</title>
<content>Content 11</content>
</item>
</data>
</mx:XML>
</mx:Application> -
Data not getting bind with cursor
Hi,
Database: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit
OS: Windows Server 2003
Consider following procedure:
Proc P1() as
cursor c(in_par varchar2) is select distinct col1, col2 from Table1 where col3 = in_par;
begin
for rec_c in c('X') loop
end loop;
exception
end;
Problem: In most of the execution, the value 'X' passed in cursor c get bind with col3 in where clause and get the desired result. However, in some cases, the value 'X' does not get bind with col3 in where clause. I don't know the steps to re-produce the issue, but it occurs once in a while.
On querying v$sql_bind_capture, i get 'NULL' in value_string whenever this problem occurs. Otherwise, I get 'X' in v$sql_bind_capture. No exception is thrown anytime.
What may cause miss of binding constant literal 'X' to cursor?Have not seen this error before - PL/SQL not binding SQL statements containing PL/SQL variables, correctly. What at times happen is no bind at all due to name collision. Using the same name for a PL/SQL variable as a SQL column in the SQL statement and scope being such that with name resolution, the SQL column gets preference. This of course does not seem to be the case here.
What could be happening is that a null variable is being passed as the bind value.
You can also have a look at the Metalink/support.oracle.com for any notes or bugs on this behaviour. Knee-jerk reaction from my side that this is too a common issue to be an actual PL/SQL bug... (would have reared its head a long time ago)
In cases like this I like to make sanity checks - reduce the problem to its bare basics with a test case and see if that works. Then gradually increase its complexity and see when it brakes, if at all. -
I created new table in database and want to bind with system form
Hi All,
1) i created new table in database and want to bind with system form .
2) How i bind this field to system form sale order where i added new folder tab in that i added some fields that fields i want to bind with database. when i click on the next ,previous ,first and last button
bind value should change.
Awaiting soon reply
Rajkumar G.hi,
try this
Public Sub BindDataToForm()
Dim oItem As SAPbouiCOM.Item
Dim oEdit As SAPbouiCOM.EditText
Dim oComboBox As SAPbouiCOM.ComboBox
'// getting the matrix column by the UID
'oItem = oForm.Items.Item("docname")
'oComboBox = oItem.Specific
'oComboBox.DataBind.SetBound(True, "OSRI", "BaseType")
'oItem = oForm.Items.Item("docno")
'oEdit = oItem.Specific
'oEdit.DataBind.SetBound(True, "OSRI", "BaseEntry")
oColumn = oColumns.Item("Code")
'oColumn.DataBind.SetBound(True, "", "DSCardCode")
oColumn.DataBind.SetBound(True, "OSRI", "ItemCode")
oColumn = oColumns.Item("Serial")
oColumn.DataBind.SetBound(True, "OSRI", "IntrSerial")
Try
oColumn = oColumns.Item("Inspection")
oColumn.DataBind.SetBound(True, "OSRI", "U_Inspection")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
oColumn = oColumns.Item("Quality")
oColumn.DataBind.SetBound(True, "OSRI", "U_Quality")
oColumn = oColumns.Item("Status")
oColumn.DataBind.SetBound(True, "OSRI", "U_Status")
oColumn = oColumns.Item("Finish")
oColumn.DataBind.SetBound(True, "OSRI", "U_Finish")
oColumn = oColumns.Item("Thickness")
oColumn.DataBind.SetBound(True, "OSRI", "U_Thickness")
oColumn = oColumns.Item("uom")
oColumn.DataBind.SetBound(True, "OSRI", "U_NetUOM")
oColumn = oColumns.Item("length")
oColumn.DataBind.SetBound(True, "OSRI", "U_Length")
oColumn = oColumns.Item("height")
oColumn.DataBind.SetBound(True, "OSRI", "U_Height")
oColumn = oColumns.Item("sqf")
oColumn.DataBind.SetBound(True, "OSRI", "U_sqf")
oColumn = oColumns.Item("sqm")
oColumn.DataBind.SetBound(True, "OSRI", "U_sqm")
End Sub -
hi,
To learn how the bidirectional binding works I made a couple of small snippets based on a textfield and a button. The objective is that with both editing and clicking on the button the string str changes. The button can be seen as the model that changes the value of the var in the other direction.
(println is just for debug)
This works:
var str = "" on replace{
println (str)
mainStage.scene.content = [
TextBox {
text: bind str with inverse
columns: 12
selectOnFocus: true
SwingButton {
translateX:50
text: "ok"
action: function() { str = "hello" }
]I made an object containing a string which also works:
class test{
var str = "" on replace {
println (str)
def mytest = test{ };
mainStage.scene.content = [
TextBox {
text: bind mytest.str with inverse
columns: 12
selectOnFocus: true
SwingButton {
translateX:50
text: "ok"
action: function() { mytest.str = "hello" }
]Finally I tried to go one level further and made the string come from another object this works but I get a warning:
class test{
var t : test1 = test1{} ;
class test1{
var str = "" on replace {
println (str)
def mytest = test{};
mainStage.scene.content = [
TextBox {
text: bind mytest.t.str with inverse
columns: 12
selectOnFocus: true
SwingButton {
translateX:50
text: "ok"
action: function() { mytest.t.str = "hello" }
warning: Target of variable select expression is not re-evaluated for bind with inverse. You may want to rewrite like the following:
def obj = <expression-without-bind>;
def x = bind obj.variableName with inverse;
text: bind mytest.t.str with inverseWhen I change the var t into def this doesn't solve the warning. And it's needed to have the str variable as a var because in real apps this will be coming from the model logic that changes this value. So why showing this warning anyway , I used def for mytest object so that the actual object can't be changed ?
Edited by: guyvo on Jan 9, 2010 9:39 PMhi stuart,
Thanks for reading and give your comments. I red a few of your blogs , interesting stuff and yes maybe you must write one dedicated on the bind with inverse !
In my app the model is mapped from XML fields into a few class objects. I instantiate these classes at startup and then read and parse my XML data into my objects. The objects will remain living until the script exits. As I bind my view with the model classes and visa versa with a double bind inverse, I think I can be pretty sure these wont garbage collected because of the double links.
Make sense that the "def temp" is only a local variable of the HorizontalBar and becomes no part of the class declaration itself. I just use this def to avoid the warning.
I even tried to add a function with a variable when creating the object without a problem although kind a useless :
HorizontalBar {
var y;
function foo (){ y = 10;};
disable:bind dis;
def temp = c.light[j];
width: 200
height: 20
posx: 10
posy: 10 + y
valmodel: bind temp.ivalue with inverse
-G -
I recently began using reminders in ical and downloaded the iPhone and iPad app. It works great. However, the reminders in ical on the COMPUTER is difficult to work with - thin long column on the right rather than in it's own screen. is there a reminders app for the COMPUTER that is more user friendly?
sgreenie,
If you are willing to wait, Apple - OS X Mountain Lion - Inspired by iPad. Made for the Mac explains that a "Reminders" application will be included in the next release of OS X. -
How to insert a null value to combobox which is bind with datasource
Hi,
i am working on c# winforms application. I have 2 comboboxes one is CustomerCbBox and another is OrderCbBox. CustomerCbBox is bind with data source.
on CustomerCbBox SelectedIndexChanged event data is populated in OrderCbBox from data source.
i want to add a null or empty field in CustomerCbBox. all I want is that when the user don't Select Customer Name and OrderNo null or empty data enter in database. but when i click Insert Button it generate error "Object reference is not "object
reference not set to an instance of an object".
here is my code.
private void MainForm_Load(object sender, EventArgs e)
production pd = new production();
CustomerCbBox.DataSource = pd.Customer();
CustomerCbBox.DisplayMember = "Cust";
CustomerCbBox.ValueMember = "CustId";
private void CustomerCbBox_SelectedIndexChanged(object sender, EventArgs e)
try
string PartyName = CustomerCbBox.SelectedIndex.ToString();
PONum1.DataSource = pd.GetPOnumActive(PartyName1);
PONum1.DisplayMember = "PONum";
PONum1.ValueMember = "PONum";
catch (Exception ex)
MessageBox.Show(ex.Message);
Please help me to solve this problem thanks.Hello,
We could check whether the user has selected any items before adding that to database.
if (CustomerCbBox.SelectedIndex > -1)
// do something
}else{//add dbnull to database}
And for adding null to databse, we could pass DBNull.Value instead.
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Importing a table with a BLOB column is taking too long
I am importing a user schema from 9i (9.2.0.6) database to 10g (10.2.1.0) database. One of the large tables (millions of records) with a BLOB column is taking too long to import (more that 24 hours). I have tried all the tricks I know to speed up the import. Here are some of the setting:
1 - set buffer to 500 Mb
2 - pre-created the table and turned off logging
3 - set indexes=N
4 - set constraints=N
5 - I have 10 online redo logs with 200 MB each
6 - Even turned off logging at the database level with disablelogging = true
It is still taking too long loading the table with the BLOB column. The BLOB field contains PDF files.
For your info:
Computer: Sun v490 with 16 CPUs, solaris 10
memory: 10 Gigabytes
SGA: 4 GigabytesLegatti,
I have feedback=10000. However by monitoring the import, I know that its loading average of 130 records per minute. Which is very slow considering that the table contains close to two millions records.
Thanks for your reply. -
What index is suitable for a table with no unique columns and no primary key
alpha
beta
gamma
col1
col2
col3
100
1
-1
a
b
c
100
1
-2
d
e
f
101
1
-2
t
t
y
102
2
1
j
k
l
Sample data above and below is the dataype for each one of them
alpha datatype- string
beta datatype-integer
gamma datatype-integer
col1,col2,col3 are all string datatypes.
Note:columns are not unique and we would be using alpha,beta,gamma to uniquely identify a record .Now as you see my sample data this is in a table which doesnt have index .I would like to have a index created covering these columns (alpha,beta,gamma) .I
beleive that creating clustered index having covering columns will be better.
What would you recommend the index type should be here in this case.Say data volume is 1 milion records and we always use the alpha,beta,gamma columns when we filiter or query records
what index is suitable for a table with no unique columns and primary key?
col1
col2
col3
MudassarMany thanks for your explanation .
When I tried querying using the below query on my heap table the sql server suggested to create NON CLUSTERED INDEX INCLUDING columns ,[beta],[gamma] ,[col1]
,[col2] ,[col3]
SELECT [alpha]
,[beta]
,[gamma]
,[col1]
,[col2]
,[col3]
FROM [TEST].[dbo].[Test]
where [alpha]='10100'
My question is why it didn't suggest Clustered INDEX and chose NON clustered index ?
Mudassar -
Facing problem with a date column in select query
Hi,
I am facing problem with a date column. Below is my query and its fainling with " invalid number format model" .
Query: SELECT *
FROM EMP
WHERE trunc(LAST_UPDATED) >= to_date(to_char(22-05-2009,'dd-mm-yyyy'),'dd-mm-yyyy')
LAST_UPDATED column is "DATE" data type.
Please help me ThanksRadhakrishna Sarma wrote:
SeánMacGC wrote:
WHERE LAST_UPDATED >= to_date('22-05-2009','dd-mm-yyyy');
You do not need the TRUNC here in any case.
I don't think so. What if the user wants only data for 22nd May and the table has records with date later than 22nd also? In that case your query willl not work. In order for the Index to work, I think the query can be written like this I think Sean is right though. Use of TRUNC Function is quiet useless based on the condition given here, since the to_date Function used by OP will always point to midnight of the specified date, in this case 22-05-2009 00:00:00.
Regards,
Jo
Edit: I think Sean proved his point... ;) -
Issue with site template that contains a document library with a lookup column to another list
I have a document library called Proposals with a lookup column in the same site called Document Categories (multiple values allowed). It points to a list called document categories. I have several sample documents in the Proposal Library that
contain valid document categories. When I save the site as a template and instantiate it, everything is fine. However, when I remove the sample documents from the Proposal library and rebuild the site template, I can't get the template to
create another site. I get an error Unable To Open Lookup List.
I don't understand why I can instantiate a site from the template when there's sample data, but not when the document library containing the lookup column is empty.
Does SharePoint 2010 site template support lookup columns?
Why would it make a difference if the library is empty?
ThanksHi,
According to your description, my understanding is that the error occurred when you created a site from the template with no files in the document library.
I tested the same scenario per your post, and I can create a site from the template with no files in the document library with no errors.
To solve this issue, I recommend to verify the things below:
Did you save the site as a template with Include Content checked? If yes, I recommend to test if it works when saving the site as a template with Include Content unchecked.
Test the same scenario with a new site to narrow the issue scope.
I also recommend to check the event log and ULS log to see if anything unexpected occurred.
To check event log, click the Start button and type “Event Viewer” in the Search box.
For SharePoint 2010, by default, ULS log is at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS.
You can check the ULS log by the methods here:
http://blogs.msdn.com/b/opal/archive/2009/12/22/uls-viewer-for-sharepoint-2010-troubleshooting.aspx
http://msdn.microsoft.com/en-us/library/gg193966(v=office.14).aspx
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
Algning new folder with other data columns in a document library
Hi All,
I have created an InfoPath form that used to create a new form & a new document library and the description to that folder.
Now my InfoPath form has some text boxes to store data. Also there is an attachment control to upload documents. These documents should be uploaded to the newly created folder.
The new folder should display at the document library as in the same row with other data columns that were inserted to the data library. I have the problem with the new folder aligning in the same row with other data.
So if someone can know how to solve this matter please enlighten me.
Thank You,
Chiranthaka.Can you provide more detail on what exactly you need to achieve and how your system is functioning at the moment? It sounds like you have an Infopath form that can have documents attached to it, you then store these documents into a new folder and wish to
have the folder represented in the list view for the form in the form library you are using? -
Issue when filtering with Managed Metadata Columns in Share Point Document Library
Hi All
I have a document library, and a four Metadata Columns in it, with each column having a number of term in it. I have no issues in adding a document or in term sets. We have set property of Managed Metadata Column as Allow Multiple Values. So some of the items
in library contains values with only one term set. While other documents contains values with multiple values.
We have a number of country sites having the document library with same metadata columns. In document library default view i am showing Metadata column, User want to filter the documents (view) based on Metadata column selected.
The filtering is giving inconsistent behavior. In production server it is giving in error with some correlation ID. On our development machine some times it is working fine and some other times it is given error of Validation of Viewstate MAC failed. i tried
on different countries sites.
I checked we have already kept the Metadata Navigation and Filtering under site action feature as activated. It was even more weird when i deactivated the feature on one country site and the filtering was working fine. And on other country site where i
kept the feature as activated and the filtering was giving an error.
Thanks & Regards
AmitHi Amit,
Have you checked the ULS error message for more information with correlation ID?
Please try using the library metadata navigation to filter these managed metadata columns value via configuring library "Metadata navigation settings" after you enabled the "Metadata Navigation and Filtering" feature,
then check if the issue would still persist.
Please see more information from below article with similar issue.
http://blog.tippoint.net/filter-by-managed-metadata-field-in-asset-picker-dialog/
Thanks,
Daniel Yang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you havefeedback for TechNet Subscriber Support, contact [email protected]
Daniel Yang
TechNet Community Support -
How to create a page to bind with spreadsheet
Hi ,
Am using jdev 11.1.2.2.0. I need to create the custom spreadsheet to integrate with fusion application. currently am referring one document which i got in google. find the link below:
http://www.oracle.com/webfolder/technetwork/tutorials/obe/jdev/obe11jdev/ps3/tutorial_adfdi/adfdinewtutorial/jdtut_11r1_59_1.html
In this example they have taken the workspace ADFdi_BC.jws . But i need the process for developing this ADFdi_BC application. And then it is very clear in the document to bind with excel.
Can you pls share this document to create ADFdi_BC application.
Thanks in advance!!!!!Hi,
I guess, this application is a simple Employee-Department application using the HR schema.You can search for a simple ADF BC application in google to get step-by-step tutorial for that.
-Arun -
Cartesian of data from two tables with no matching columns
Hello,
I was wondering – what’s the best way to create a Cartesian of data from two tables with no matching columns in such a way, so that there will be only a single SQL query generated?
I am thinking about something like:
for $COUNTRY in ns0: COUNTRY ()
for $PROD in ns1:PROD()
return <Results>
<COUNTRY> {fn:data($COUNTRY/COUNTRY_NAME)} </COUNTRY>
<PROD> {fn:data($PROD/PROD_NAME)} </PROD>
</Results>
And the expected result is combination of all COUNTRY_NAMEs with all PROD_NAMEs.
What I’ve noticed when checking query plan is that DSP will execute two queries to have the results – one for COUNTRY_NAME and another one for PROD_NAME. Which in general results in not the best performance ;-)
What I’ve noticed also is that when I add something like:
where COUNTRY_NAME != PROD_NAME
everything is ok and there is only one query created (it's red in the Query plan, but still it's ok from my pov). Still it looks to me more like a workaround, not a real best approach. I may be wrong though...
So the question is – what’s the suggested approach for such queries?
Thanks,
Leszek
Edited by xnts at 11/19/2007 10:54 AMWhich in general results in not the best performanceI disagree. Only for two tables with very few rows, would a single sql statement give better performance.
Suppose there are 10,000 rows in each table - the cross-product will result in 100 million rows. Sounds like a bad idea. For this reason, DSP will not push a cross-product to a database. It will get the rows from each table in separate sql statements (retrieving only 20,000 rows) and then produce the cross-product itself.
If you want to execute sql with cross-products, you can create a sql-statement based dataservice. I recommend against doing so.
Maybe you are looking for
-
I little confuse about build ANE, I already follow all the direction, but the error always #3500 when I try to call the ANE. I create ANE using java android. The tools I use : Flash Builder running on Win-64 win.7. I think I must straight to the poin
-
Purchases page keeps crashing, I had to reset my device and I would to reload apps help
I had to reset my device after last software update, I got back some of my purchased apps but since it had been awhile since I actually synced to my PC i lost a ton. Like 300 apps. Every time I go to the "purchased" section of the App Store my device
-
No request has been set up as the standard transport request for BEx object
Hi gurus, I have this error in a query . Have someone any ideea what is this? Thanks, Ramona
-
Multiple systems on the same computer
I have installed CC on both my work and home computers (as allowed with the license). However, at home I have both Mac and Bootcamp systems. I mostly use the mac side but rarely need the window side. Sometimes I am under the windows side and need som
-
Required config changes to move DB to another server
Can someone provide instructions on what config changes need to be done to move the database to another server? I am assuming there is documented instructions to accomplish this task, but I can not find them. Thanks.