C # How do I set up a flexible framework for changing controls from an assembly later?

I am still new to C # and I am working on a project where we also use WPF and WPF DataGrid Toolkit (see CodePlex) which has not been released into framework yet. Due to the nature of the project, he is 100% confident that we will be changing some of the build controls later. My colleagues decided to override each control from the datagrid in the namespace of our project and set specific control of the assembly namespace. So instead of using: CLR names: Microsoft.Windows.Controls.Primitives; assembly = WPFToolkit CLR Names: Microsoft.Windows.Controls; assembly = WPFToolkit We will use our own xxx.Controls and xxx.Controls.Primitives. Namespaces. So it would be pretty easy to change the ihnerited controls.

Somehow, I got a bad feeling about this solution, but I'm still inexperienced and can't tell if such an approach is legal or not, or if there is another good solution to our requirements (change the controls later without changing too much code in multiple files).

It would be nice if you expressed your opinion on this matter.

+1


source to share


2 answers


What changes are you talking about? It seems like a waste of time to proactively output from each class before you know what you really need to change.

When you need to change something, it shouldn't be too difficult to create a derived class at that point and fix any references that might only be for some instances, not all. Yes, this could mean checks involving quite a few files, but if you are using a sane source control system it will be an atomic change and it will be obvious why this changes.



In your current approach, there is no immediate "these are the controls we should have changed" - if you do it on a just-in-time basis, you can tell just by looking at which derived controls you actually need to create.

+1


source


I agree with you. Changes, or rather, changes, can be of any kind. Behavior, etc. And the changes must be made just in time. Unfortunately, this is not my solution. Some stubborn ones are at work :)

But what interests me if there is a completely different approach to the whole idea? Let's say I have a DataGrid, the project is evolving and now I need to make some radical changes to test the behavior of the dataGrid rows. This can apply to many controls as well.



The problem with our project is that we have a kind of complex data access layer that not only provides the data, but actually manages it. This means that d ata is not read, modified, removed, or added , without including some of the logic provided by the data access layer.

For example, the datagrid does not directly delete rows, but instead we overwrite the delete behavior and at the data access layer to delete it. With linkage, this works pretty well at the moment. This scenario will apply to a lot of other things in the future regarding CRUD operations, validation, etc.

0


source







All Articles