|
Nice :p
When I alter the top combobox so that it's just like the bottom.
So remove from C# code:
this.cbCustomer.ItemsSource = dsOrder.Customer;
And add
ItemsSource="{Binding Source={StaticResource Customer}, Path=.}"
It doesn't work anymore then.
When I look at this:
<Window.Resources>
<src:OrderCustomerDataset x:Key="Customer" />
</Window.Resources>
It doesn't really say to me that it is the right instance of the DataSet/DataTable to bind to, how should I refrace that so that it binds to dsOrder.Customer? I think that's the part that's missing
|
|
|
|
|
Well, you need to design the stuff as I mentioned earlier. Why dont you have a Wrapper Object containing Orders and Customers. You bind your main Window to this wrapper. Then, bind the Orders Grid View to DataContext.Orders and the customer combobox to DataContext.Customers (where DataContext is the datacontext of the main Window which you can reference it in the nested objects using the word "DataContext").
The path you are taking might also work. I do not know what OrderCustomerDataset is ?? If it is an object having a list of Customers then,
ItemsSource="{Binding Source={StaticResource Customer}, Path=ListOfCustomers}"
Remember, you will also need to handle the display of the appropriate customer in the combobox based on the CustomerId of the Order. On changing the customer the customerid in the orders table also has to be updated. You can use a ValueConverter(or MultiValueConverter) to drive the SelectedValue of ComboBox based on parameters and handle the combobox selection change.
Hope that helps(or makes matters worse??)
|
|
|
|
|
|
I am trying to follow Karl Shifflett or Josh Smith MVVM pattern but I don't fully comprehend how I can make this happen. And I am hoping that I can get some help here.
I have an Object_A with some attributes, and an ObservableCollection<object_a>. Then in the UI I have a "view" of the attributes of Object_A, with a list box below which has the ObservableCollection<object_a>. What I want to be able to do is to be able to edit the attributes of the selected item in the list box and I want to be able to add a new Object_A if the "Add" button is clicked. This is where I get confused, because it is technically not bound any longer to the object in the list box it is it's own object that needs to be inserted into the ObservableCollection<object_a>.
I have two separate views and two view-models, and the "Add" button on the Object_A view-model, raises an event and passes the new Object A to the View-Model for the collection of Object_A, and if I set a break point and look at the Collection View-Model's ObservableCollection<object_a> which the UI is bound to the ObservableCollection<object_a> shows that the count has changed, but the UI doesn't reflect this change, is like the UI doesn't get notified that the ObservableCollection<object_a> has changed and the List box should be updated.
What should I be doing to get the UI to "refresh" itself when a new Object_A is being inserted into the ObservableCollection<objecta>?
|
|
|
|
|
Well - if you add the object to the ObservableCollection, the UI will be updated for you automatically (assuming you've used the appropriate bindings). How have you set up the Mode on your listbox? That's possibly where you are having a problem - try setting it to OneWay.
|
|
|
|
|
I was thinking it could be something with me overriding the OnCollectionChanged, but when I took that completely out, it still didn't work so I was thinking that it was something else.
|
|
|
|
|
If I could see the markup, it will be easier to get an idea.
|
|
|
|
|
Here is the XAML
<listbox x:name="lstScreens" xmlns:x="#unknown"> IsSynchronizedWithCurrentItem="True"
Grid.Row="1"
ItemsSource="{Binding Path=ReportScreens}"
ItemTemplate="{DynamicResource ScreenTabScreen}"
Margin="10,0,10,10">
And I can email any/all of the code for these areas if you would like.
|
|
|
|
|
Sure - my email is pete dot ohanlon at gmail dot com.
|
|
|
|
|
Hi - I'm still waiting for the code. If you want to zip your project up, I'll take a look at it later on. My email is in my earlier post.
|
|
|
|
|
Sorry, Pete I did send you the code on Wednesday I used pete.ohanlon@gmail.com. I resent the code again just now, it will come from zoey.babongita@gmail.com.
If you don't get it soon, please let me know, You should have two emails now, the first one being a few classes, and the second one being the entire solution. Pick your poison.
Thanks
|
|
|
|
|
I've got them now. It looks like the original mail was picked up by the spam filter (though I'm not sure why). I'll take a look at them when I get home tonight.
|
|
|
|
|
Hi there, I've been working with Bea's solution here for a while and finding it very helpful. Problem now I'm having is when I drag-n-drop items within or to another ListView control and I want to scroll up/down "during" the drag (moving an item from index 30 to index 1), it's not happening. I would have to drag to the top of the visual items in the ListView, manually scroll up, then drag again, eventually ending at the position I want. This isn't very user friendly.
Now I found the function (DragDropHelper.DropTarget_PreviewDragOver) that I would want to do the testing of which item is being dragged over, and I'm getting that.
<br />
Dim pt As Point = e.GetPosition(DirectCast(Me.targetItemsControl, UIElement))<br />
<br />
' Perform the hit test against a given portion of the visual object tree.<br />
Dim result As HitTestResult = VisualTreeHelper.HitTest(Me.targetItemsControl, pt)<br />
Now from there I can get the DependencyProperty of this visual hit
<br />
Dim lvi As ListViewItem = TryCast(GetDependencyObjectFromVisualTree(TryCast(result.VisualHit, DependencyObject), GetType(ListViewItem)), ListViewItem)<br />
Which is of a ListViewItem. Now in the function DropTarget_PreviewDragOver I have the "DraggedItem" which is of type Picture in Bea's example, but that can change depending on the ObservableCollection you have bound to the ListView. Now, I want to drag the ListView up or down depending on where the mouse is on the control. I've attempted with the below un-finished non-working code
<br />
If lvi IsNot Nothing Then<br />
If pt.Y <= 25 Then<br />
Dim lv As ListView = TryCast(targetItemsControl, ListView)<br />
If lv IsNot Nothing Then<br />
Dim index As Integer = lv.Items.IndexOf(lvi)<br />
If index > 1 Then<br />
lv.ScrollIntoView(lv.Items(index - 1))<br />
End If<br />
End If<br />
Else<br />
If pt.Y >= Me.targetItemsControl.ActualHeight - 25 Then<br />
Debug.Print("Scroll Down")<br />
End If<br />
End If<br />
End If<br />
Can someone point me in the right direction to get this ItemsControl or ListView to scroll when dragging over the items??
Thanks!
|
|
|
|
|
hi everybody!
I have a problem that I can't find a solution.
I made a project (vs2008 xp sp2) wpf browser aplication.
I need to use midi functions of winmm.dll but there is a problem with "System.Security.Permissions.SecurityPermission".
I made a simple project (code below) with a button where by pressing it the debug stops.
.....
using System.Runtime.InteropServices;
namespace WpfBrowserApplication1
{
public partial class Page1 : Page
{
[DllImport("winmm.dll")] public static extern int midiInGetNumDevs();
public Page1()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
int aa = midiInGetNumDevs();
}
}
}
What shall I do? Somebody can help me?
My final project is to realize a musical keyboard that should play music according to a partiture upon the web. (sorry for my english)
Many Thanks for your attention.
|
|
|
|
|
Calling into native code probably isn't something that you can do in a WPF browser app since they normally run in a partial trust environment: WPF Partial Trust Security[^].
As far as your goal of a musical keyboard deployed to the web is concerned:
* look into the possibility of using Silverlight (Silverlight Audio and Video Overview[^]
* you could go with a regular WPF application and distribute it using ClickOnce (see what MediaElement can do for you here)
|
|
|
|
|
Hi ,
i'm trying to understand how create role and save them in the database so doing i can add or delete the role for each user when i need ...i explain better my idea.
I created a form authentication(username,password) in Wpf to access to the application now i wish create roles and save on the database(with Linq ToSql) so doing i will assign roles(to deny or access to use buttons,Forms,Delete,Add,Edit etc.etc.) to user's for use the application but i don't know how procede with code to create roles and save it on database.
Do you have any idea to clarify my purpose and procede to work out this feature?
Have a happy day.
Bye
|
|
|
|
|
Sorry ,
maybe my question is not clear i fell confuse about that....
If you have some link that can clarify my mind i'm happy for your support.
Have a nice day.
Bye
|
|
|
|
|
In order to make this message go away on WCF method invoke,
"cannot be ISerializable and have DataContractAttribute attribute"
I commented out "Serializable" and ISerializable
<br />
[DataContract()]<br />
[GenericObjectAttribute(ObjectClassifier = "Person")]<br />
public class Person : IPerson
{<br />
...<br />
}
Does this means all DataContract must NOT be ISerilizable?
Thanks!
dev
|
|
|
|
|
If you turn your DataContract into a NetDataContractSerializer, you can mark it as Serializable. However, the DataContract is serialized for you by WCF so you shouldn't need to manage this yourself.
|
|
|
|
|
|
No problem.
|
|
|
|
|
Hi all,
I'm very new to WPF and so don't mind me asking very silly questions.
Well I'm creating this application where I have a window which hosts a "login" and a "loginCheck" usercontrol. Both usercontrols are not visible at the same time and have the same background but different foregrounds elements. When the user clicks the sign in button in the Login usercontrol I want the Login usercontrol to make a flip and show the loginCheck usercontrol where the authentication will happen and feedback the user about successful or unsuccessful login status and then if its unsuccessful then again flip to the login side, but if its successful I want it to fade away and get removed from the parent container(as in children.remove(login)).
Now my problem is I have created both login and logincheck usercontrols but how can I make the login to logincheck 3D flip happen after the user presses the "Sign In" button from the login usercontrol and also remove it after successful authentication.
Any help would be deeply appreciated.
Regards,
Soham Dasgupta
|
|
|
|
|
Hi,
My problem is when i am trying to use the header value of existing treeviewitems.
Let me explain the situation.
1)I have a label .I want to give content to that lable.
2) I have treeview control with 1 parent and 3 childs.I am using context menu .
I am using this context menu for the above tree control. i have one menu item in the context menu.
3)So whenever i do mouserightclick on any node of treecontrol(without selecting node--simply mouserightclick on nodes) it will display menuitem of context menu.(selecting node also ok.but currently i am trying without selecting the node)
4)if i click the menuitem it will fire an event , in which i am assigning content to label
5) I want to assign the currentnode header value to label content
I am trying it through code.of course i don't know how it will be done in xaml also.
Still i am thinging whether it is possible or not?
If possible could anyone provide source code to overcome this probelm as soon as possible
Thanks in Advance
Rama Krishna Makkena
|
|
|
|
|
From what I could understand, in the context menu items click event you want to set a controls property ??
If yes, I found this on msdn [^]
Karl Shifflet has given the following suggestion, "Have you tried databinding a specific value to the menuitem? You can stick a value in the Tag property, or you can add a property to the MenuItem in a derived class."
You might need to handle OnContextMenuOpening Example[^]
|
|
|
|
|
Hello everyone,
I have canvas that contains several controls representing network nodes. There are several types of nodes. After selecting one node I need to display property page for it. Each node type has its own customize property page. For example there are nodes that can be accessed via RS232 or TCP/IP or WLAN. Property page should allow to change connection setting and display statistical info about selected connection.
I would like know whats the WPF way of doing such a thing, what would be the 'cleanest' solution?
|
|
|
|