Telerik Forums
UI for WPF Forum
0 answers
93 views

I created a class with CommunityToolkit.Mvvm package and use ObservableProperty to create properties for this class. But the PropertyGrid  control does not recognize properties created in this way. Are there any way PropertyGrid  can support ObservableProperty?


using CommunityToolkit.Mvvm.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Test
{
    public partial class DrawingModel : ObservableObject
    {
        public string Name { get; set; }

        [ObservableProperty]
        public double _length;


        [ObservableProperty]
        public double _width;

        [ObservableProperty]
        public double _height;
    }
}

Jian
Top achievements
Rank 1
 asked on 24 Jun 2024
1 answer
51 views

Please see attached image. What could be the cause of this? Some Fonts missing?

I'm using StyleManager for Theming.

Stenly
Telerik team
 answered on 20 Jun 2024
2 answers
86 views
I have a XAMLDataProvider that is binding a string property to a RadRichTextBox.

I want to be able to bind the content of the RadRichTextBox to a string (which I have done) and then once a save button is pressed, I need to run some code similar to this.
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
RadDocument document = new RadDocument(string myXAMLString);
byte[] output = provider.Export(document);

Essentially I need to be able to bind a property from the ViewModel to RadRichTextBox..... which I am doing with XAML data provider.

Then after a save button is clicked, I take the property which is a string and I need to create a RadDocument from the string that represents that and export that document to a byte[].

Is there an easier and better way to be doing this?

Thanks!
Matt
Top achievements
Rank 1
Iron
 answered on 20 Jun 2024
1 answer
250 views
It is not in Telerik.Windows.Controls.dll for WPF70 2024.2.514.70
Dimitar
Telerik team
 answered on 20 Jun 2024
2 answers
59 views

Hi,

i found a sample:


    <Window.Resources>
        <local:DoubleToDateTimeLabelConverter x:Key="DoubleToDateTimeLabelConverter" />
    </Window.Resources>
    <Grid>
        <telerik:RadCartesianChart>
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:LinearAxis>
                    <telerik:LinearAxis.LabelTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding StringFormat='h:MM tt', Converter={StaticResource DoubleToDateTimeLabelConverter}}" />
                        </DataTemplate>
                    </telerik:LinearAxis.LabelTemplate>
                </telerik:LinearAxis>
            </telerik:RadCartesianChart.HorizontalAxis>
            
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:CategoricalAxis />
            </telerik:RadCartesianChart.VerticalAxis>
            
            <telerik:LineSeries CategoryBinding="City" ValueBinding="StartTimeOA" ItemsSource="{Binding}" />
        </telerik:RadCartesianChart>
    </Grid>


        public MainWindow()
        {
            InitializeComponent();

            var Items = new ObservableCollection<PlotItemViewModel>();
            var dateTime = DateTime.Now;
            Items.Add(new PlotItemViewModel() { City = "Atlanta", StartTime = dateTime.AddMinutes(5) });
            Items.Add(new PlotItemViewModel() { City = "Atlanta", StartTime = dateTime.AddMinutes(10), });
            Items.Add(new PlotItemViewModel() { City = "New York", StartTime = dateTime.AddMinutes(100), });
            Items.Add(new PlotItemViewModel() { City = "Miami", StartTime = dateTime.AddMinutes(120), });
            Items.Add(new PlotItemViewModel() { City = "Miami", StartTime = dateTime.AddMinutes(150), });
            Items.Add(new PlotItemViewModel() { City = "Savannah", StartTime = dateTime.AddMinutes(200), });
            Items.Add(new PlotItemViewModel() { City = "Birmingham", StartTime = dateTime.AddMinutes(250), });
            Items.Add(new PlotItemViewModel() { City = "New Orleans", StartTime = dateTime.AddMinutes(280), });

            this.DataContext = Items;
        }
    }

    public class PlotItemViewModel
    {
        public string City { get; set; }
        public DateTime StartTime { get; set; }
        public double StartTimeOA { get { return this.StartTime.ToOADate(); } }
    }

    public class DoubleToDateTimeLabelConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double doubleValue = double.Parse(value.ToString());
            return DateTime.FromOADate(doubleValue);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

The Result is:

Here is the Dateformat "us-US" (10:05 AM / 4:06 PM) but i need German "de-DE" (10:05 / 16:06) !

Have anyone a idea how i can do this?

Best regards

Bernd

 

 

BerndR
Top achievements
Rank 1
Iron
 answered on 19 Jun 2024
1 answer
79 views
We have the similar problem on 2024.1.228.45
https://www.telerik.com/forums/gridview-celleditended-returns-null-data-properties-for-custom-column

Is there any solution to get NewData and OldData on OncellEditEnded for a custom column?
Martin Ivanov
Telerik team
 answered on 18 Jun 2024
0 answers
40 views
I have a button which inserts a table.


myRichTextBox.InsertTable(2,4)

I want to modify some properties on the table after it is inserted.

I want to set fontsize, fontfamily, change border and cell color to RED and make it so that the table will always fill the available width. Is this a possibility? Or do I have to manually build out the entire table and insert at cursor location?
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 17 Jun 2024
0 answers
68 views

Hello,

I'm trying to remove tab items from RadTabControl where ItemsSource is bound to an ObservableCollection<RadTabItem>. However, when an item is deleted from the collection the tab does not disappear. The desired behavior is for the tab to disappear. What do I need to do to achieve this?

Here's what I have:

xaml declaration:


 <telerik:RadTabControl x:Name="radTabControl"  
                     
                                ItemsSource="{ Binding Tabs }"
                                Padding="0, 0, 0, 0" 
                                Margin="0, 0, 0, 0" >

         </telerik:RadTabControl>

 

Here, I declare Tabs as an observable collection:

   public ObservableCollection<RadTabItem> Tabs { get; set; }

Here is where the tab items are deleted:


  private void RemoveTab(int dev)
        {
                Tabs.Clear();
 
        }

 

I'm not very familiar with WPF and Telerik in general. Any help would be appreciated.

Thanks.

Noah
Top achievements
Rank 1
 asked on 11 Jun 2024
2 answers
87 views

Hi,

I'm using the CellLoaded event to customize a RadGridView. Setting a background brush and foreground + fontweight for the TextBlock in the cell works as expected. I'm also using the AutoGeneratingColumn event to set a DataTemplate for a column.

Now I want to use DataTemplates for individual cells. But when I do so I have to set a DataTemplate for every cell, every time it's rendered. If I'm not setting a DataTemplate I get a random content from a random cell, everytime a cell is scrolled into view. If I'm using DataTemplates for all cells I can't edit the cells anymore.

 

Is there anything I can do to stop the RadGridView messing up my cells? Changing the virtualization settings didn't changed anything, even if I disabled virtualization (VirtualizingPanel.IsVirtualizing="False").

 

This is my GridView now:

<telerik:RadGridView AutoGenerateColumns="True"
                     VirtualizingPanel.VirtualizationMode="Recycling"                                     
                     Grid.Row="1"
                     x:Name="Gv"
                     Margin="0 20 10 0"
                     SelectionMode="Extended"
                     SelectionUnit="Cell"
                     CellLoaded="GvCellLoaded"
                     BeginningEdit="GvEditBegins"
                     CellEditEnded="CellEditEnded"
                     AutoExpandGroups="True"
                     GroupRenderMode="Flat"
                     ValidatesOnDataErrors="None"
                     telerik:TouchManager.TouchMode="None"
                     CanUserSortColumns="False"
                     CanUserSortGroups="False"
                     IsReadOnly="False"
                     AllowDrop="True"
                     ItemsSource="{Binding Items}"
                     FrozenColumnsSplitterVisibility="Collapsed"
                     ContextMenuOpening="GvContextMenuOpening"
                     ScrollViewer.VerticalScrollBarVisibility="Visible"
                     ScrollViewer.HorizontalScrollBarVisibility="Visible"
                     PreviewMouseRightButtonDown="GvRightMouseDown"
                     PreviewMouseLeftButtonDown="GvMouseDown"
                     PreviewMouseLeftButtonUp="GvMouseUp"
                     AutoGeneratingColumn="GvAutoGenerate">
Hendrik
Top achievements
Rank 1
Iron
 answered on 11 Jun 2024
1 answer
490 views

I was surprised when I downloaded the latest Q2 release to not find any folder with .NET 8 DLLs, only .NET 7.

NET 7 is already at "End of Support" as of May 14th according to Microsoft.

https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core

Considering NET 8 is designated as having LTS (long term support) from Microsoft I was wondering what Telerik's plans are regarding a NET 8 release of your WPF suite?

We would like to move from .NET 6 which we currently use, to .NET 8 which has LTS.

Martin Ivanov
Telerik team
 answered on 11 Jun 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?