GridViewDataColumn formatiing from code mvvm

0 Answers 24 Views
Top achievements
Rank 2
Florin asked on 27 Jan 2023, 06:30 PM

Hy everyone,

I have a collection from DB:

var dynamicOutput = _sql.LoadData<dynamic, dynamic>(@"SELECT * FROM " + procedura.Trim() + "(@IdRamura, @DataRef)", p);

RaportRentabilitateGrid2.AddRange(dynamicOutput );

private ObservableRangeCollection<ExpandoObject> _raportRentabilitateGrid2 = new ObservableRangeCollection<ExpandoObject>();
public ObservableRangeCollection<ExpandoObject> RaportRentabilitateGrid2 {
            get { return _raportRentabilitateGrid2; }
            set {
                _raportRentabilitateGrid2 = value;

So far everything works ok

I have the RadGridView:

<telerik:RadGridView x:Name="oRaportRentabilitateDet1" DockPanel.Dock="Top"
                                         Style="{StaticResource ContasGridviewStyle}"
                                         SelectedItem="{Binding SelectedRaportRentabilitateGrid2,Mode=TwoWay}"
                                         ItemsSource = "{Binding RaportRentabilitateGrid2, Mode=TwoWay}"

And, for formatting the column in the RadGridView with the name DATA, i have the code:

            var delaColumn = oRaportRentabilitateGrid2.Columns["DATA"] as Telerik.Windows.Controls.GridViewDataColumn;
            delaColumn.DataFormatString = "dd.MM.yyyy";

But, it's not working...

I can't figure out why...

Thanks a lot.

Martin Ivanov
Telerik team
commented on 31 Jan 2023, 12:57 PM

I've tested this but I couldn't reproduce the issue. On my side the DataFormatString is applied properly. You can check the attached project and let me know if I am missing anything.

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 2
Share this question