Can I auto calculate discounts in devexpress textedit using only properties? - winforms

Is this possible? I've seen their demo, the thing is when the value of the discount changes the total also changes but I never see the code with the formula.
How can I do this?

Related

Set Full width row color for a parent group separor

We want to change the color for the parent row to have a certain color.
This way we can better see in which parent we are working in.
I got "something" working with a hover that looks like this (removed important information):
This is what we want to achieve but then for only the parent rows.
Is there any possibility to do this or are there any work arounds to become this effect ?
Many thanks for the help in advance for any unclarity or questions please ask!
Kind regards,
Joey Driessen
Unfortunately, it's not possible, but I can suggest coloring the names of the grouping tasks and/or change their font size. Please check this sample: https://playground.anychart.com/xuqwNO3f
And learn more about the labelsOverrider() method here: https://api.anychart.com/anychart.core.ui.DataGrid.Column#labelsOverrider
We have found a solution.
We have checked the source code for what you guys are doing for making a row selectable (and coloring the whole row).
Then we are using the .labelsOverrider function to get all the items in that column.
We check which ones are our grouping and on the grouping item we call the meta function like follows meta('selected', true) and that makes sure we set this row as selected and giving us the appropiate result.
Looks like follows:

How to dynamically update result on textbox_textchange in WPF?

I have a tax calculator, with 1 input and 2 results in textboxes. User inputs amount, result 1 will show Result2 - Input and result 2 will just show the calculation done in Button.Click.
How do I make it so that it auto changes the results in the 2 textboxes on every keystroke with the input Textbox? I tried to use sendkeys Enter on textbox.change but WPF doesn't have sendkeys. Please help!
Rather than repeat all of the details of an answer I provided to another SO user I'll just put a link to it here.
If you were to use that logic then you could pick up the textbox's TextChanging event use that to carry out your logic and presumably update the properties to which your other text boxes are data bound thus automatically updating them as you require.
There is an assumption here on my part that you are using mvvm. If you aren't then what you want to achieve should be pretty straightforward in the code behind so long as you have remembered to name everything.

Is there a possibility to sort dojox.calendar events in columns within the column?

I have about 10 to 15 calendars I want to show in a single day ColumnView. To see free room for more events I want each calendar to have it's own column within the column view. I set the overlap to 0, but all events of one calendar need to be in the same column.
Looking at the demo I want to have all red events on the left side of the column and all blue events on the right side.
Is there a possibility to do this or is it easier to create multiple calendar-widgets for the specific calendars?
Thanks in advance!
In your use case, the absolute solution would be to manage multiple columns per day which is not implemented by the dojox.calendar yet.
Feel free to register a feature wish on the github page: https://github.com/damiengarbarino/dojo-calendar in the Issues section.
With that said, you can change the layout priority of events see: http://livedocs.dojotoolkit.org/dojox/calendar#layout-priority
Set a custom priory function that takes into account the calendar of a data item to column view layoutPriorityFunction property.
This is a sorting function, so it takes 2 items to compare and return 0 (not useful here), -1 or 1.
Hope this helps,
Damien

DataGrid - Displaying Running Total From Top of Grid Through Current Row

How would I display a running total for a particular column of each record that is displayed in a DataGrid? I'd like to keep the computation logic in the view model.
Desired Output:
Value | Running Total
25 25
10 35
-2 33
Thank you,
Ben
Edit: Keep in mind that when a user-triggered DataGrid sort occurs, the running totals must be recalculated because the record display order has changed.
I'd really like to put the logic for this in the view model, not in WPF code (e.g. not using an IValueConverter).
It is only idea: actually, DataGrid uses ICollectionView interface ( http://msdn.microsoft.com/en-us/library/system.componentmodel.icollectionview.aspx) to implement sorting (as described in http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid(VS.95).aspx at Grouping, Sorting, and Filtering section.
So, you can create class that implements ICollectionView interface, and observe sorting with corresponding updating of running total.
I don't know there is a recommended / supported / simple way to do this. The choices I can think of are:
1) Have some ui element outside of the data grid to hold the total. This is easy to bind to your VM but a bit of a pain to work out the alignment issues that will come up, as you likely want the total right under the column. This is what I would recommend.
2) Have a dummy last row in the grid; this solves the alignment problem but adds hacky logic to the VM, and probably doesn't look so great on top of it.
HTH,
Berryl
If you don't mind the answer in VB or C# then this tutorial shows how to do what you want in VB and this tutorial shows it in C#. Both use a dummy column in the grid.
I ended up solving this problem by extending DataGrid to expose a property which could be bound to a "resort has occured" callback on the view model.
Details: http://bengribaudo.com/blog/2010/07/14/3/datagrid-per-row-running-totals
Check out this answer for how to add a row count column to a ListBox and populate using a value converter. Instead of counting item, add up the sum of items. If you need the total sum in your VM this is of course not a good solution.
Numbered listbox
long cumulative = 0;
List<int> Values = GetValues();
Values.ForEach(v => v.RunningTotal = cumulative = cumulative + v.Value);
You can just run foreach for the whole list and get your running total by the formula
(RunningTotal = cumulative = cumulative + Value);
We need to continously save the previous value.

Excel like FILTER feature in Silverlight datagrid?

In Excel, there is this feature for filtering the cells of a column.
How can I implement excel like FILTER feature in Silverlight Datagrid?
Please advice. Thanks
AJ
Good question - this is a good feature, but not one that can be implemented in 5 minutes.
You don't want to be overriding the rendering of the standard datagrid in any way (too much work), so you need to take a slightly different approach. One way to do that is to draw your own 'header' above the top of the grid - just a grid, with a border and a stackpanel will get you started. Then you need to enumerate the visible columns of the grid, and create a dropdown corresponding to each, and add that dropdown to the stackpanel. Using a simple linq statement you can get a list of the distinct values in each column. When the user selects a value from the dropdown you can then filter the grid's datasource using that value in a LINQ statement.
In reality this is probably going to be at least a week's worth of work to do properly. If you take the cost of that development and the cost of the testing, and measure that against the cost of a good component suite where they already have filtering built in (most of the major vendors do), then unless you are working for a very low hourly rate you will find it is cheaper to buy the components - it is probably safer too, as the components will be well tested and realtively bug free.
Edit (some time later): what i should also mention though is that if you only want to do this on a couple of columns then you could consider using a column header template. If you take this approach though you will also have to do things like copy the various mouse related animations or transitions that might be part of the original colunm header, just so you can keep some consistency across the top of the grid. Personally i would just go with option one and give the user the ability to filter on any of the columns.

Resources