Hello,
I’m new to WPF so what I’m asking may be simple it’s just that I’m inexperienced and may not know what I need to do.
Basically, I have a XamDataGrid control that is used to edit a collection of business/domain objects. The object being edited is not known until runtime. The object contains enough metadata to create my field layout and assign the correct data types, positions, etc. I’m having problems with lookup/combox types though. A developer can assign a lookup “Collection<KeyValuePair<TKey, TValue>>” to the business/domain class and the application/grid is supposed to use these values exclusively.
I’ve seen plenty of examples on how to do this though Xaml, but, I cannot figure out how to do this programmatically, although I think I’m getting closer.
What I need to accomplish.
1. Binding my business/domain object to the grid.
2. Allow for updating/editing/adding.
3. Bind certain fields to a combox and have the underlying data source (business object) reflect the changes.
4. Must be done at runtime though code.
So far I have the following code (only relevant code is posted) but my behavior is not correct. Firstly, the combox itemsource is set in the CreateLookup function, but my bindings are not being set correctly. Secondly, I had to use the Loaded event to set my bindings otherwise the dropdown contained the “ToString()” value “[B, Business], [I,Individual]” etc. Thirdly, the combobox does display, but when the first selector (arrow) is clicked a combox appears and then I have to click it again. I like the look of the original selector and I would like to keep it as the default and just display my contents at that point.
I’m not opposed to using a resourced style in xaml as long as I can change the source value at runtime. I tried that as well (see xaml snippet at the end of the posting). This is actually ideal, I just couldn’t figure out how to make it work correctly.
Any assistance would be greatly appreciated; I’ve been stuck on this single item for 3 days now. If you need any additional information please let me know and I’ll be sure to reply.
TIA,
Jared
private void BindStagingRecords()
}
</Grid.Resources>
Hello jaredwri,
I have been looking into this for you and I can suggest you use the XamlReader class to easily load the same Style from code and this will also provide you with the opportunity to embed a variable on the spot from code behind. Here is a forum thread:
http://community.infragistics.com/forums/t/48810.aspx?PageIndex=1
in which it is discussed how to do so. Please note, we are making efforts to ensure that all posts are addressed by an Infragistics expert. We believe that the other community users could benefit from this thread as well.
Feel free to write me if you need further assistance.