|
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
|
|
|
|
|
Depends on your "templating". The "contents" are the things you load (.Items). The item template, default or custom, deals with the visuals. The default "data" is via ToString().
.net - Default ItemTemplate of Controls like ListBox/ListView - Stack Overflow
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
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.
|
|
|
|
|
You are reinventing the wheel - clickonce deployment with different config files and different compile directives. You have 2 distinct deployments, UAT and production.
Alternatively if you just want to allow the user to change DBs then change the connection string when the user decides.
Caveat - change the background colour of the UAT version. You do not want the user to have any doubt which version they are entering their data into.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
- Have you tried to publish using ClickInce in VS2017? Doesnt work. That's the whole reason I did my own.
- I'm hoping that the user should not have to take any action when launching the app, like picking a DB.
- Already did the coloring scheme for Test vs Production.
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.
|
|
|
|
|
I suspect event handlers in the code-behind will be the only way to handle this.
MVVM discourages event handlers, but there are still times when you have to resort to them.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I guess I could wire up an event, then in the code behind's handler get the VM and call a method on it, but thsi seems ugly.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I'm not sure why you'd need to call a method on the VM to start editing a cell in the grid?
The other alternative is to use a behaviour, as described in this SO answer:
c# - Single click edit in WPF DataGrid - Stack Overflow[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That behavior is just what I'm looking for. I said use the code behind because all the examples I found on enabling cell editing use a row or cell selection event.
Thanks.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Hello,
Whenever I'm trying to create a new window in a WPF project (C# or VB) in Visual Studio 2010, it fails to load the designer of the window and shows an error describing: Quote: Could not load type 'Microsoft.Expression.DesignModel.Core.ISharedInstanceBuilder' from assembly 'Microsoft.Expression.DesignModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.'
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.
Regards,
Priyam
|
|
|
|
|
Trying to design with Blend, and Blend is not installed? Using a more "recent" version of Visual Studio would probably help.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
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.
|
|
|
|
|
I have created a user control that wraps a Barcode Reader SDK. I used it like this:
<local:BarcodeScannerView RegistrationName="{Binding DataContext.RegistrationName, ElementName=window}"
RegistrationKey="{Binding DataContext.RegistrationKey, ElementName=window}"
Camera="{Binding DataContext.CameraName, ElementName=window}"
BarcodesToFind="{Binding DataContext.Barcodes, ElementName=window}"
ResolutionHeight="{Binding DataContext.ResolutionHeight, ElementName=window}"
ResolutionWidth="{Binding DataContext.ResolutionWidth, ElementName=window}"
ScanDelay="{Binding DataContext.ScanDelay, ElementName=window}"
PlaySound="{Binding DataContext.PlaySound, ElementName=window}"
Enabled="True"/>
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.
|
|
|
|
|
|
This is a school assignment I have, just so you know.
A quick overview of my assignment is, that I create a UML class diagram for a game, and from those classes create a class library in C#.
That class library has to be imported into a WPF project where I use those classes and create a functioning game.
The point of the assignment is for the students to practice object oriented programming, so everything has to be in classes that we create ourselves.
The problem is, I'm am not too well-versed in WPF. I know that if I doubleclick on a button-control, code will automatically be generated where I can manipulate with different controls and data etc, but I don't know how a method in an instantiated object (or a static one) from a class library can get called when I click on a button-control, and then use that method to change text content in fx. a label.
I was thinking of creating a "UIManager" class that updates the WPF controls depending on the game state, but I have no idea how to create methods that will take WPF controls as parameters, in a class that is in a class library. For some reason I can't use the "using" statement to use the WPF specific namespaces in my class library project, but I don't even know if that is the solution to my problem.
I emphasize the class library because it is a requirement that it is done that way.
Any help, hint or guidance is very much appreciated.
|
|
|
|
|
If you want to create a WPF class library that can also include WPF "windows" XAML and code-behind, then just add references to the dll's that are normally "missing" versus a straight WPF "exe" (like Framework.dll, etc.)
Same goes for the "user controls" included in said class library.
I don't think you're being asked to actually "manipulate" the XAML.
Study one of the WPF Toolkits: that illustrates the type of architecture you're going after.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Thanks for the fast reply!
I think I know what you mean, so I'll try to figure it out.
|
|
|
|
|
i copied 5 dlls into the folder specified in the ModulePath use the code in Bootstrapper:
protected override IModuleCatalog CreateModuleCatalog()
{
DirectoryModuleCatalog catelog = new DirectoryModuleCatalog();
catelog.ModulePath = @".\Modules";
return catelog;
} .
but after the application started ,only 4 of the modules were loaded.
but if i use
protected override void ConfigureModuleCatalog()
{
base.ConfigureModuleCatalog();
ModuleCatalog moduleCatalog = (ModuleCatalog)this.ModuleCatalog;
moduleCatalog.AddModule(typeof(moduleA));
moduleCatalog.AddModule(typeof(moduleB));
moduleCatalog.AddModule(typeof(moduleC));
moduleCatalog.AddModule(typeof(moduleD));
moduleCatalog.AddModule(typeof(moduleE));
}
all the modules will be loaded properly.
Who can tell me what's wrong with my code ?Thanks in advance.
|
|
|
|
|
I created a copy of my App.Config called "Release.Config". When I do a Release build, the following Post Build code is run:
if "Debug"=="$(ConfigurationName)" goto :nocopy
del "$(TargetPath).config"
copy "$(ProjectDir)\Release.config" "$(TargetPath).config"
:nocopy
This renames the file "Release.Config" to the output folder as "App.Config".
The problem is that the Visual Studio installer seems to be taking the Debug App.Config, not the Release version. Doesn't the installer project use the release code?
Anyone have any ideas on this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: Visual Studio installer Are you actually using VS Installer to deploy your application?
I would think the Configuration Manager would be the appropriate tool to deploy an application (never used VS Installer).
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Mycroft Holmes wrote: Are you actually using VS Installer to deploy your application?
Yes
Mycroft Holmes wrote: I would think the Configuration Manager would be the appropriate tool to deploy an application (never used VS Installer).
How would that hepl? The problem isn't the configurataion. When I do a release build, the correct app.config is in Bin\Release. The proble is that the installer isn't getting the right App.Config. it's somehow getting the app.config from bin\debug.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You could try using a configuration transform instead. Unfortunately, Visual Studio only supports them in web projects, but there's an add-in which adds support for other projects:
Configuration Transform - Visual Studio Marketplace[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Great I'll take a look. Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|