|
Hi,
in a WPF application, I have two windows:
MainWindow - with the read-only ListView1 and the EditItem button
EditWindow - with Submit button.
After clicking on the EditItem button, a new EditWindow is shown, binded to the ListView1.SelectedValue . After clicking Submit , the updated values should be saved back to the underlying data classes and the ListView1 should be updated.
As far as I understand, the OneTime binding mode with explicit update is what I am looking for. Unfortunately, I have found no way how to set up the binding of the EditWindow in this OneTime mode (I do not see setting OneTime mode for each textbox as acceptable workaround).
How to open the EditWindow , bind it to the ListView1.SelectedValue and update it after clicking on the Submit button?
Currently, I have the following code for opening the EditWindow :
EditWindow frm = new EditWindow();
frm.Owner = this;
frm.DataContext = ListView1.SelectedValue;
frm.ShowDialog();
Thank you.
|
|
|
|
|
Hi,
This is just a guess, but maybe if instead of setting the edit form datacontext directly to the selected value, try using a one-time data binding instead there. This is just a guess.
|
|
|
|
|
Hi,
thank you for your tip and sorry for my delay in answering.
Unfortunatelly, One-time data binding means that the IDataError or ExceptionValidationRule logic would not provide user immediate feedback on invalid values. So I need something like data object transaction.
As a result, I have created a deep copy of edited data row and after submitting the edit form, I am copying the values back to the original row object. Quite boring, but as far as I know, there is no better solution.
|
|
|
|
|
How do I work with WIndows Forms in WPF?
In my WPF program I created a Windows Form class.
In this Form, I placed an OK button and I went into the properties of the button and set the DialogResult to OK.
Now, I am calling this Dialog (Window Form) from the MainWindow.xaml.cs:
DialogResult dres;
dres = form.ShowDialog();
if (dres != DialogResult.OK) return;[/code]
The compiler is complaining:
Error 3 'System.Nullable<bool>' does not contain a definition for 'OK' and no extension method 'OK'
accepting a first argument of type 'System.Nullable<bool>' could be found (are you missing a using directive
or an assembly reference?)
|
|
|
|
|
WinForms uses its own version of DialogResult. You need to add a reference to Windows Forms to your project and then reference the OK as System.Windows.Forms.DialogResult.OK .
"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
|
|
|
|
|
Is it possible to subclass a Window in WPF, so that I can create a base Window class? If so, how?
Everything makes sense in someone's mind
|
|
|
|
|
Hi Kevin,
Create your CustomWindow derived from Window and if you want, you can create the Template for your new Window and assign to it. Let me know if you need more help on it.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
I'd like to see an example of that, if you have one.
Everything makes sense in someone's mind
|
|
|
|
|
Hi,
Have a look into this blog post for Silverlight: Creating a Custom Out-Of-Browser Window in Silverlight[^]
There are some good example for WPF too. I will share those links if I recall the URLs from my bookmark.
Till then check for the Silverlight one. You will get the basic understanding from the same.
Let me know, if you have any queries.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Hi Experts,
I googled a lot to display multi columns on selecting a combobox(i.e datagridcombobox) in WPF datagrid, but couldn't find relevant solution. Pls help.
-Thanks in advance
Kartheesh.
|
|
|
|
|
This may be a trivial question but I'm completely new to Silverlight and right now I just want to know if I can embed a Silverlight control in my "classic" AST.NET (3.5) WebForm page?
Googled for samples but no result.
_____________________________
...and justice for all
|
|
|
|
|
You cannot embed silverlight control individually.
You need to generate .xap file from the silverlight page/control
and then you can easily embed it in aspx page as an object.
Find following code to embed .xap file.
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SLNetWCF.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
d00_ape wrote: Googled for samples but no result.
You cannot do this and that is why you found no results.
As is posted in the other answer, you can embed your xap control inside the page.
You can probably search for some controls for Asp.net which do something similar to what you are using in Silverlight.
My signature "sucks" today
|
|
|
|
|
Hi,
Is there any way to remove(or hide) the legend from the charting control(PieSeries) and bind the ItemKey instead of ItemValue to display the ItemKey on mouseover .
As I have the following colloection:
ItemKey ItemValue
Delhi - 5
UP - 4
MP - 3
I am binding the following way:
<chartingToolkit:PieSeries <br />
IndependentValueBinding="{Binding ItemKey}" <br />
DependentValueBinding="{Binding ItemValue}"<br />
AnimationSequence="Simultaneous"<br />
IsSelectionEnabled = "true">
Thanks,
Sri
|
|
|
|
|
You need to use style templates as shown here.
My signature "sucks" today
|
|
|
|
|
Is it possible to bind multiple values to a single component in XAML?
I want to put two values into a single TextBlock with one binding attribute. Possible?
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
You could do this with the MultiValueConverter available here[^].
"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
|
|
|
|
|
Thanks. I'll look at that at home in the next couple of days (this is for a WPF front-end to my CP article scraping library).
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
Ah hah.
"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
|
|
|
|
|
The convert thing won't work for what I need. I just created additional properties that provide the needed data and bound to those instead.
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
Hi,
Did you ever figure this out.
I am trying to do the same thing where if I am binding a property called Score to my WPF data grid, I need the value of it to be reflected when one of the dependency properties changes....
for instance:
Class A : INotifyPropertyChanged
property Score
Class B : INotifyPropertyChanged
property Score (this property value should be dependent on the composition of two ClassA.Score values and should display in the same column that is bound to Score in the Data Grid.
Kindly let me know if you found a solution.
Thanks
|
|
|
|
|
when i am swaping element in grid its refelecting on form but at time of saving when i ll go for reading it will not give me updated one .
for swaping i am using Grid.SetRow and Grid.SetColumn function.
Border borderInnerAttr;
Grid.SetRow(borderInnerAttr, Grid.GetRow(borderInnerAttr) - 1);
Grid.SetColumn(borderInnerAttr, Grid.GetColumn(borderInnerAttr));
here i am able to swap element in grid but at the time reading grid it will return me the original position of elements.
Pls help me ....
Reasons are not Important but Results are Important.
http://www.sql4professional.blogspot.com
Swati Tripathi
modified on Thursday, May 27, 2010 8:54 AM
|
|
|
|
|
This should be easy but I can't get to work. I just want to set the value of a textbox when the select value in a list box changes.
Here's how it works in a combobox.
Category.Text = ComboBox1.Text
How does it work in a list box in vb.2010 (WPF)?
|
|
|
|
|
Have a look here.
The equivalent of Category.Text = ComboBox1.Text is a little different in WPF.
You need to link the CurrentItem of a listbox to your textbox.
The link above might give you a better idea.
My signature "sucks" today
|
|
|
|
|
Thats good info, but I really do not want to databind that textbox. I'm binding back to SQl already I just want to give the user an easy way to populate/change the field value. The combo works, but a list box looks much better. I'm making it visilble from a click event.
Thanhks for the info.
|
|
|
|