Telerik Forums
UI for WPF Forum
0 answers
189 views

Hello,

I'm creating my columns dynamically, and when I click on a column header to sort it, it hides the rows instead of sorting them.

When I click again rows are still hidden (the sorting is descending), then when I click again, the sorting is None and the columns reappear.

Here is what I've tried already.

DataType

I've read on this forum that it happens when the DataType of the columns is not set, but I have my custom class of columns inheriting from GridViewDataColumn and I set the DataType to be the type of the value contained in the cell, so I think I'm fine on this side.

IComparable

I made all of my types implement IComparable, but it didn't help.

SortMemberPath

I tried setting SortMemberPath on my columns, doesn't help either. My rows are inheriting from DynamicObject, and I can see that the method TryGetMember(GetMemberBinder binder, out object result) (which I override) is indeed called when the grid starts sorting. So it seems to work well with DynamicObject, I'm not sure that having a DynamicObject could be an issue, but still, it might be worth mentioning.

OnSorting

I tried subscribing to OnSorting on the RadGridView and do my own logic in here, but when reassigning the rows by doing args.DataControl.ItemsSource = myRows.ToList(), it resolves my Linq query and throws an ArgumentException: "At least one object must implement IComparable", which I don't understand because I made sure all of my types implement IComparable.

So I tried blindly implementing IComparable on the classes representing my rows and cells as well, as a shot in the dark, but their implementation didn't get called so I don't know which objects the query really operates on.

IsCustomSortingEnabled

Also, I made sure that I'm setting IsCustomSortingEnabled on all of my columns when I create them.

ColumnSortDescriptor

I started creating my own ColumnSortDescriptor and overriding CreateSortKeyExpression, but I feel like using a simple linq query in OnSorting should be enough for my case, so I'm not sure it will help.

The End(?)

As you can see, I tried many things in very different ways and I'm running out of ideas now.

What can I do to sort my dynamic columns? Thanks!

P.S: I will try to make a simple demo project out of this, but I hope you'll be able to provide me with a simple answer in the meantime. Fingers crossed :)

Eldoir
Top achievements
Rank 2
Iron
Iron
Iron
 updated question on 28 Oct 2022
1 answer
287 views

I have a RadGridView bound to an Obersvable Collection of an object with ID and Name. After closing the window, I save the selected IDs in an list. When the user reopens the form to select more items, I want to show all the items but disable the rows based on the IDs that were previously selected (those on the IDs list).

How can I achieve that?

 

I think that the best solution is a behavior and not a style, but I don't know how to do it.

Martin Ivanov
Telerik team
 answered on 28 Oct 2022
1 answer
142 views

Hello,

I have a xaml with RadGridView which contains 4 columns. One of the columns has DataMemberBinding to a Double number/property and a cell template with a NumericUpDown control which is binded to the same Double property.

When I click the RadNumericUpDown arrow to change the value and the control remains Focusded and click immediatly the CellHeader for sorting, sometimes the value of some rows are changed to be the value of other rows. This is happens when I click the header many times with RowVirtualization=False.

If I click the arrow of the RadnumericUpDown and then I click another control to remove the focus and then I can click the header many times and the issue can't be reproduced. The update source trigger is PropertyChanged.

Sometimes during sorting the value is changed and then restored to the correct one.

Please I would like to know if you can fix it or give me some workaround. This is a very simple requirement (sorting). 

Martin Ivanov
Telerik team
 answered on 28 Oct 2022
1 answer
108 views

Hello,

I asked this question for the radrichtextbox:

https://www.telerik.com/forums/radrichtextbox-get-selected-revisions#5508333

And the answer was very helpful! Unfortunately I am finding that I need to do this operation in a bit more of a granular fashion. For example, if the tracked change is an insert (for example 'This is brand new text'), is there a way that I can highlight a subset of the inserted text (for example 'brand') and mark it as deleted?

Or, if this is impossible, is there a way to find all text that has been marked as 'strikethrough' and remove it?

Vladislav
Telerik team
 answered on 28 Oct 2022
1 answer
164 views
Is there any best practice using WPF Syntex Editor for Lua scriptting Syntax?
Stenly
Telerik team
 answered on 27 Oct 2022
0 answers
225 views

Binding and using this control feels quite terrible at its current state. 

My case: I want to display "HH:mm" .. as Maskk = "##:##" 

Value binding happily accepts string "10:00"

but while editing the value the propertychanged event can return "1000" which isn't compatible with the converter i've made. 

Text binding ONLY works in Mode=OneWayToSource in combination with Value binding Mode=OneWay 

Text="{Binding ToTime, Mode=OneWayToSource}"
Value="{Binding ToTime, Mode=OneWay}"

HOWEVER - when binding like this, the control doesnt clear the text when bound value changes to NULL 

eg: ToTime was "10:00" changes to NULL

The control keeps displaying "10:00"

Changing UpdateSourceTrigger from PropertyChanged to LostFocus makes the control completely faulty.. it simply stops displaying. 

ARGH

Why on earth is there two binding fields - where both are so faulty ? 

I wish there was only ONE : the Text field. 

This field should emit the masked value, whenever the UpdateSourceTrigger dictates. 

This Text field should accept "1000" as well as "10:00" but ALWAYS return "10:00" in the propertychanged event.

I'm considdering using a completely different control from another vendor instead of this mess :( 

Martin
Top achievements
Rank 2
Iron
Iron
Iron
 updated question on 27 Oct 2022
1 answer
126 views

I would like to create a MapEllipse from Code Behind using values that I have stored.

But the property Center only has a get method.

How can I determine the Center of the MapEllipse from Code Behind?

 

 

var mapEllipse = new MapEllipse();
mapEllipse.Width = mapEllipse.Height = 50;
mapEllipse.Fill = Brushes.Yellow;
mapEllipse.Opacity = 0.2;
mapEllipse.Stroke = Brushes.Red;
mapEllipse.StrokeThickness = 2;
//mapEllipse.Center = ?

 

Thanks

 

Dilyan Traykov
Telerik team
 answered on 27 Oct 2022
1 answer
146 views

Hello, 

Is it possible to have content display vertically in the RadExpander, and collapse horizontally as seen in the attached image?

We need the arrow buttons to be on the right and the expander to collapse to the left.

Thanks

Martin Ivanov
Telerik team
 answered on 27 Oct 2022
0 answers
157 views

Hi,

I'm using a customized style for RadCombobox.

The problem is, I found it impossible to reverse the dropdown button(arrow) when it is clicked.

I want the arrow to go up when the combobox expands and go down when the combobox collapses.

 

Can Anyone give me an example code of this?

Jinny
Top achievements
Rank 1
 asked on 27 Oct 2022
1 answer
249 views

Hey,

I downloaded the demo code and created a control called "RadRichTextBoxToolBarControl". This control contains many controls:  RadRibbonComboBox to change font Family and Size, FormattingColorPicker to change text color, etc.

The DataContext of the control is RadRichTextBox, Path=Commands.

This way allowed to have all the functionality with zero code behind.

The RichTextBox gets the style according to the RadRichTextBoxToolBarControl as expected.

The problem is that after I wrote some text and change the text style (font family, size, color) then I should click the end of the line to have the focus on the RichTextBox and start typing.

The problem is that the new text uses the style of the text to the left of the cursor instead of the styling configured in the toolbar. 
I would like to have the same behavior as word. While typing or selecting text, the style should be inherited from the toolbar options.

Unfortunately, I can't share my code but I think that the explanation is enough.

Vladislav
Telerik team
 answered on 26 Oct 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?