Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.

Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.

Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.

If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.

Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.

Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.

Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.

If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.

No advertising or soliciting.

We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.

If you're displaying the 2nd window from within the first one, just create an overloaded constructor int he 2nd window, andinstantiate it with the necessary data.

".45 ACP - because shooting twice is just silly" - JSOP, 2010-----You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010-----When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

I'm working on an app that manages home building projects. A house can have floors, and this is a BuildingTypeEntity. Examples are "1 Story", "2 Story", etc. Parts, supplies, and equipment are delivered to the job site periodcally. Generally every few days. These deliveries are called "Schedule Packs", and that's represented by the SchedulePackEntity

Packs has a property called Days, which is the number of days past the project start date when the delivery will be made.

Ok, now the problem:

There is one part of the UI where the user can select which Packs they need for a project. Then, the pack data needs to become a "horizontal version" of the data represented as a DataGrid. Please see this screenshot.

On the left side is a list of Building Types built as Expanders with DataGrids inside. This part works fine.

The right side is what I need to build. Notice that there are expanders, and in each are one DataGrid for each floor. So on the right side, under 2 Story, are 1st Floor with its selected packs as columns of a grid, and next to that is 2nd Story with its selected packs as columns of a grid. There needs to be one grid for each floor, arranged horizontally. Only the packs that are checked on the left side should appear as columns in their respective DataGrids on the right side.

The summary of the problem is how to turn a vertical list of classes, 1 to however many there are in the list, to a DataGrid with those ojects as columns.

I'm open to suggestion on a different approach, or if someone has done this, I'd like to hear how.

Thanks

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

Bind your right-hand view to a list of BuildingTypeViewModel objects. Within each expander, bind an ItemsControl to the Floors property. Within the data template for the ItemsControl, display the Floor, and bind the grid to the Packs property. Let WPF auto-generate the columns for the grid, and it should work.

"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

This seems to be one way. It can get a ListBoxItem but not return it to the ListBox after it is edited.

To be more exact about what I want to do. Given a ListBox and search key, I want to highlight or change the color of items that contain the search key. I do not want to edit the text in the list. I want to keep the list browsable and still contain all items. Change the search key: a)highlight different items in the ListBox b)clearing those that are no longer contain the search key.

So many years of programming I have forgotten more languages than I know.

Try
Add a property to your listbox data source - IsMatched (probably a string with the colour name)
bind the back colour of your ListBoxItemTemplate to the IsMatched property of your data item
During the search event change the IsMatched value
Reset event should clear the IsMatched value back to the default, ptobably Transparent

Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP

I'm working on an automatic updater for my WPF app. When I do a publish, it copies those files that changed to my server. Then, when the user double-clicks the icon, it checks my server for changes, downloads them, starts the app. Everything works great.

What I'd like to do now is set it up for a test environment. This means that I want it to target a copy of the production DB. It will copy the changed files to an alternate location, different than the production location, but target the Test DB instead of Production. All the code files will be the same.

The question is, what's the best way to tell the code to go look at the test DB versus the production db? One idea I was considering was using the existance of a file to trigger test mode. So, if file "TestMode.txt" was in the EXE's location, then start in test mode, else start in production mode.

Anyone have any better ideas?

Thanks

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

1. Amazing, I used clickonce deployment for many years for both winforms and WPF and while fiddly to set up once done it worked like a dream for over 20 applications across 5 countries.

2. We deployed 2 distinct applications adding a UAT suffix to the assembly name and Assembly information. We then used Configuration Manager to have 2 additional formats pointing to the different locations and DBs.

3. [snicker] I once had to use a modal dialog to inform a user they were in the UAT version after they ignored the bright orange background.

Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP

I've been Googling this all morning, and all of the examples I've found use events in the code behind. I'm doing MVVM.

When I select a row in a data grid, I want to turn on cell editing on the 3rd cell. The first two cells are read only. By default, the user has to select the row, then double-clck the cell to enter edit mode.

Anyone have an example of how to do this?

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

However, I've Visual Studio 2017 installed in my PC too. But it doesn't show this message and WPF projects open and run just fine in it. Even, my WinForms projects in Visual Studio 2010 run absolutely fine. The problem is with WPF projects only.

Why am I getting this error in Visual Studio 2010 and how do I solve this problem? Please help.

You're right Gerry. I also have VS 2017 installed in the same PC, but it works absolutely fine. As I'm working on a project that was originally done with VS 2010 and the client is unwilling to upgrade at this point, hence, I was looking for a workaround. I found a thread here that discusses on the problem in details. It seems there's a lot of issues dealing with this problem in VS 2010 that involves installing, uninstalling and re-installing quite a few utilities. Keeping this in mind, it's better to shift to VS 2017 as it runs butter smooth. Instead of wasting time on configuring VS 2010, I'll now have to try to spend it in convincing my client to upgrade.

The problem is that I really need Enabled to fire last, AFTER all the other DP values have been set. What I'd like it to have all property values set, THEN allow Enabled to turn on the camera. Right now, Enabled seems to fire FIRST.

So, is there a way to control the firing sequence of the DP's?

One idea is to to some kind of setup involving all the other DP's when Enabled is set.

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.