WPF End-User Conditional Formatting Solutions - c#

WPF makes it very easy to create conditional formatting rules at design time based the underlying bound data values.
Are there any existing solutions that allow end users to create conditional formatting rules at run time?
Edit: I understand how to apply conditional formatting. I am curious if there are existing solutions that provide mechanisms for end users to create custom styles at run time
Edit: Excel's Conditional Formatting capability could be viewed as an example of the type of capability I am looking for

Karl Shifflett did a demo LOB application in WPF a few years ago. He demonstrated a way to dynamically load XAML "skins" in your application. Using this type of logic, a customer could create XAML and load it dynamically to skin the application, or you could provide an interface for a customer to dynamically change style properties and have the application appearance change based on those property settings.
His example is on his blog as well as on the Code Project.

Everything done in WPF via XAML can be done in C#, so you can create styles and triggers with C# only.
Here's an example.

For runtime formatting solutions, I would suggest using value converters.
You can get inputs from end users on what kind of formatting they need. And apply them in converters.

The following link How to customize tool item and tool container may help you. The LinsUIWPF suite is a free software. It allows end client to customize all tool items and tool container style.

Related

Why use Xaml markup in Xamarin.Forms projects if i can do all job in C# file?

Why I should use Xaml markup in Xamarin.Forms projects if I can do all job in C# file? I think about this a lot time. I did not find answer about that in Google search. I think with C# I can do my apps faster than with using Xaml. Maybe someone know something fundamental about that? I'm new in Xamarin.Forms.
Why i should use Xaml markup in
It is easier to express visual coding patterns in Xaml as templates than to attempt it in code. Once a template is defined, say within a list, the data it represents will be repeated for each data item based on that one template.
It appears easier for you to code it, because I surmise you are now learning about Xaml and getting it working is the more important.
The rule of thumb is that Xaml specified should define a bare framework and the data will fill in that framework. By doing it in Xaml it can be created and more importantly updated using the Xaml design view (editor) to achieve the end goal.

Displaying a file in WPF

I want to create a program that will enable user to open a file. That would create a new tab and assign a class to that tab that contains over 200 fields of various types (which I have already designed, along with read and write code of the program).
Then I would create an interface that would enable user to change any of that 200 fields.
Does that mean I have to create a property for each and every single of 200 fields that I have in order to bind them with fields?
Is there another way? Is this kind of program more viable for WindowsForms?
It seems a lot easier to do this programmatically instead of using XAML.
Is there a 3rd solution?
Maybe you are looking for the PropertyGrid. It may be not as beautiful as you'd expect, but it would cover major of your needs. There're some customizations examples, but it still looks ugly (IMO).
Otherwise you could create a control by yourself. Define deferent templates for various types of your properties. It shouldn't be difficult: some reflection, create bindings via C#, some templates.

Custom PropertyGridEditor etc. for web part edit zone?

I want to change the appearance of the default editor parts, and am a little unsure of how to go about doing this, as there seems to be a surprising lack of documentation on the subject.
I've been able to create a custom declarative catalog with some trial and error and overriding the RenderCatalogPart method, and now wish to do something similar with my AppearanceEditor and PropertyGridEditor. I've tried just changing the style of the editor parts using CSS, but they are already arranged into tables which are impossible to get rid of. It's not even possible to just take the class as is, because the classes are sealed. So I'm basically stuck with having to write my own from scratch, I guess the questions are as follows:
1) How do I go about getting the information on the controls I need to render?
2) According to the documentation, I need to override the ApplyChagnes and SyncChanges methods - but I can't find any information on what I actually need to put in these methods.
3) On a similar note, is it possible to change the layout of the EditorPart itself, so that the AppearanceEditor, BehaviourEditor etc. are displayed side-by-side instead of on top of eachother?
4) Is there any way to have the page catalog displayed somewhere on the page, even in browse mode? I'd quite like to use it as a 'minimised' area, where users can send web parts they don't want immediately. At the moment they go back into the page catalog and users tend to just add a new part instead. I know that I can have multiple catalog zones on the page, which is great, but it only shows up in catalog mode.
Any help would be very much appreciated.
I didn't get any replies here, but I was able to figure out a way to do some of these.
In the end I decided to use reflection to get each public property on the web part that was WebBrowsable, and figure out what sort of control to display from the type.
The ApplyChanges() and SyncChanges() methods essentially just persist the changes from the page to the personalization blob and vice-versa. It's a matter of rendering some controls on the page, and mapping the values to the properties of the web part in these methods.
I don't think this is possible without writing your own.
Haven't been able to do this, but I don't imagine that it's possible sadly.

Create winform from xsd dynamically

I am writing an XSD parser which dynamically builds simple WinForm (based on input XSD scheme).
I want to use only xsd defined structures, not adding anything beyond xsd standard elements.
Questions:
I want xsd:element to define a control. How to distinguish which xsd:element defines which control type (especially the bolded ones)? (basic are TextBox, TextArea(multiline textbox), ComboBox, RadioGroup(group of radiobuttons), DateTimePicker, CheckBox, Panel, Button).
How about labels - maybe is it better to define them inside xsd:element of other control containing data (TextBox, etc.)? How ?
I need this parser to enable the clients to generate a schema by 3rd party tool then populate the XSD into my app and open WinForm (without need of programming it) and in further steps produce xml with data and some output.
I think you can get a lot of ideas by having a look at XMLSpy. Specifically, their Stylevision technology is probably very similar to what you are trying to achieve.
I think it also highlights a bit of an issue with your concept in general - an XSD does not contain all the necessary information regarding how to capture the data that the XML will represent. You could assume default editors for specific types, etc, but pretty soon you will run into cases where someone wants something to work differently, and XSD will not, by default, support it. I am pretty sure you will end up with some non-standard extensions, which no out of the box tool will support, or your own XML-language for defining screens. Nevertheless, I suggest having a look at XMLSpy, some of their tooling is excellent and should give you some ideas.

Simplify configuration dialog building .NET

I am working in C#. I find myself creating dialogs for editing my application settings all the time. For every Control on the dialog I am reading the configuration file and set it accordingly. After pressing OK, I am reading all the controls and store the values in the configuration files or something similar again.
This seems to be very time consuming, simple and repetitive. Does anybody have an idea how to simplify this process? Code generation? Helper classes?
You can bind WinForms controls directly to application settings, which should make your life a lot easier for creating dialogs to manage them.
Just select a control and look for the (Application Settings) option under the Data group in the properties pane. I put up a screenshot here to illustrate.
Do these application settings dialogs need to be pretty or are they simply there for personal configuration? If it's the latter, read all the settings into a class and assign that class to a property editor.
Not recommended for a good-looking, final UI though.
Best bet would be to use the "Settings" that are included in the default template for a winforms rather than "configuration" it is easier and the settings can be bound to just about any property for a control or read independently. Once discovered they are well documented, easy to customise and easy to use.
If you need to use configuration then I'd look at using a custom configuration section and bind that to a property grid or control set for editing. The configuration makes it easy to read and write changes to the configuration.

Categories

Resources