Telerik Forums
UI for WPF Forum
0 answers
20 views

Hi,

Is there a way to change the icon for the rad expander from the circle with a '<' or '>' to an icon and shape that I define?

Thanks

Tony

Tony
Top achievements
Rank 1
 asked on 10 Oct 2024
0 answers
29 views

I'm sure this is trivial, but I've been unable to find the answer.  I have a RadGridView defined as follows:

<telerik:RadGridView
    ItemsSource="{Binding Products}"
    SelectedItem="{Binding SelectedProduct, Mode=TwoWay}">
    ...
</telerik:RadGridView>

However, when I change the "SelectedProduct" programmatically, the RadGridView doesn't show that highlighting.  What am I doing wrong?

Bradley
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 09 Oct 2024
4 answers
149 views
Hello,

in many menus I use the same buttons.
Is it possible to create a kind of a base class?

In this case it would be nice to have a base class of the complete group header "actions".

eg:

<telerik:RadRibbonView ApplicationButtonVisibility="Collapsed"TitleBarVisibility="Collapsed" HelpButtonVisibility="Collapsed">
            <telerik:RadRibbonTab Header="Home" HeaderVisibility="Collapsed">
                <telerik:RadRibbonGroup Header="Actions">
                    <telerik:RadRibbonButton LargeImage="{StaticResource Back}" Text="Close" Size="Large"
                                                      Command="{Binding CloseViewCommand}" />
                    <telerik:RadRibbonButton LargeImage="{StaticResource Edit}" Text="Edit" Size="Large"
                                                      Command="{Binding EditItemCommand}" />
                    <telerik:RadRibbonButton LargeImage="{StaticResource Save}" Text="Save" Size="Large"
                                                      Command="{Binding SaveItemCommand}" />
                    <telerik:RadRibbonButton SmallImage="{StaticResource Cancel}" Text="Cancel" Size="Large"
                                                      Command="{Binding CancelItemCommand}" />
                </telerik:RadRibbonGroup>
 
                <telerik:RadRibbonGroup Header="Print">
                    <telerik:RadRibbonButton SmallImage="{StaticResource Print}"  Text="xxx" Size="Large"
                                                      Command="{Binding PrintItemCommand}"/>
                </telerik:RadRibbonGroup>
 
                <telerik:RadRibbonGroup Header="Extras">
                    <telerik:RadRibbonButton SmallImage="{StaticResource UpdatePortrait}"  Text="xxxxx" Size="Large"
                                                      Command="{Binding UpdatePictureCommand}"/>
                </telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>


Thank you,
Manuel
Jacob
Top achievements
Rank 1
Iron
 answered on 09 Oct 2024
1 answer
21 views

Hey,

I am using a DragDropManager to drag images from a itemscontrol onto a table.
Now I want to rotate the image, if the user presses the Key "R" during Dragging.

But I dont get it to work.
All Input Bindings on the Window and DataTemplate did not fire.
Does anyone have an idea to achieve what I want?

DragDropManager.AddDragInitializeHandler(icImages, OnDragInitialize);
private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
          
            clsImage imageData = (clsImage)((FrameworkElement)e.OriginalSource).DataContext;

            DragDropData dragData = new DragDropData
            {
                ImageData = imageData ,
                Column = Column
            };

            e.Data = dragData;
            e.DragVisual = new ContentControl { ContentTemplate = LayoutRoot.Resources["ImageTemplate"] as DataTemplate, Content = imageData };
            e.AllowedEffects = DragDropEffects.All;

            e.Handled = true;
        }
            <DataTemplate x:Key="ImageTemplate">
                <Grid>
                    <telerik:RadSvgImage
                        UriSource="{Binding file}"
                        HorizontalAlignment="Left"
                        SizeType="ContentToSizeStretch"
                        OverrideColor="{Binding ImageColor}"
                        />
                </Grid>
            </DataTemplate>
Stenly
Telerik team
 answered on 09 Oct 2024
1 answer
29 views

I ran into this problem when experimenting with VirtualGrid, but trying to work with Multiple selection mode seems completely broken. I have even created a new project from scratch and only imported the following packages:

telerik.windows.controls.for.wpf.xaml (2024.3.924)
telerik.windows.controls.virtualgrid.for.wpf.xaml (2024.3.924)

My MainWindow.xaml looks like:

<Window x:Class="TestVirtGrid.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TestVirtGrid"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
        <telerik:RadVirtualGrid x:Name="VirtGrid" CanUserEdit="False" Grid.Row="0" SelectionMode="Multiple" SelectionUnit="Row" />
        <Button Grid.Row ="1" Content="amon"/>
    </Grid>
</Window>

The code-behind looks like:

using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.VirtualGrid;

namespace TestVirtGrid
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            ObservableCollection<Test> list = [];
            for (int i = 0; i < 20; i++)
                list.Add(new Test() { a = i, b = i });
            VirtGrid.DataProvider = new DataProvider(list);
        }

    }
    public class Test
    {
        public int a { get; set; }
        public int b { get; set; }
    }
}

When running the application, I'm able to select rows, but deselecting is clearly not working as intended. When I try to deselect, it often just completely fails to do so. Sometimes (like, 1 in 5 tries?) it does end up deselecting the row.

If there's something I've done wrong here, please let me know, otherwise I'd like to get some confirmation that this module doesn't work.

Martin Ivanov
Telerik team
 answered on 09 Oct 2024
1 answer
10 views

Hey guys,

I'm currently using the CloudUpload to upload files to an internal server.
This happens over multiple single steps in clsDaten.UploadReklamationsDateienKEMdoc.
This would return a true if succesfull uploaded and a false, as well as an error message if not.
I now want to show this error message in the interface and an Error sign instead of the succesfull check.
But I dont find anywhere how.

Does anyone have an idea?

Greetings Benedikt

    public class clsCloudUploadProvider : ICloudUploadProvider
    {
		long uploadFilesCount = 0;

		clsReklamation Reklamation;

		public Task<object> UploadFileAsync(string fileName, Stream fileStream, CloudUploadFileProgressChanged uploadProgressChanged, CancellationToken cancellationToken)
		{
			return Task.Factory.StartNew<object>(() => UploadFile(fileName, fileStream, uploadProgressChanged, cancellationToken), cancellationToken);
		}

		private object UploadFile(string fileName, Stream fileStream, CloudUploadFileProgressChanged uploadProgressChanged, CancellationToken cancellationToken)
		{
			this.uploadFilesCount++;
			var fileLength = fileStream.Length;

			uploadProgressChanged(fileLength);

			object[] ImportState = Import(fileStream, fileName);

			if ((bool)ImportState[0])
			{
				return fileName;
			}
			else
			{
				return null;
            }
		}

		public object[] Import(Stream filestream, string filename)
		{
			return clsDaten.UploadReklamationsDateienKEMdoc(Reklamation, (filestream as FileStream).Name);
		}

		public clsCloudUploadProvider(clsReklamation reklamation)
		{
			Reklamation = reklamation;
		}
	}


Martin Ivanov
Telerik team
 answered on 08 Oct 2024
1 answer
19 views

Our application has a RadVirtualGrid that can be much wider than the window (so it scrolls).  Our SelectionUnit is set to "Row".  But when I hit Ctrl + End the grid not only jumps to the last row, but also scrolls the last column into view.  It seems to me that if the SelectionUnit  is "Row" the control should just jump to the last row and not change the column or scroll status at all.  I guess the same thing is true about ctrl+Home to go to the top.  Anyone agree?

Thanks!

Nathan

Martin Ivanov
Telerik team
 answered on 07 Oct 2024
1 answer
22 views

Hi,

We are getting an exception when trying to set the CaretPosition in a RadDocument.

The Document is created in code:


        public void PurchaseTemplate()
        {
            try
            {
                RadDocumentEditor editor = new RadDocumentEditor(doc_text.Document);
                string[] rowName = new string[] { "Make", "Model", "Technical Spec.", "Order No.", "Date Ordered", "Date Delivered", "Price", "Payment Method", "Supplier", "Tel.", "Other Details", "Manufacturer", "Tel.", "Other Details", "Guarantee", "Period", "Expiry Date", "Notes" };

                TableWidthUnit w1 = new TableWidthUnit(180);    // Date
                TableWidthUnit w2 = new TableWidthUnit(500);    // Day

                TableCell cell1 = new TableCell();
                TableCell cell2 = new TableCell();

                TableRow row = new TableRow();
                Paragraph p1 = new Paragraph();
                Span s1 = new Span();
                string subject = " ";
                if (_selelement != null)
                {
                    subject = _selelement.GetAttribute("title");
                }


                Table table = new Table();
                table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;
                table.Tag = "5000";
                table.Rows.ElementAdded += doc_text_DiaryChanged;

                cell1.Background = Color.FromRgb(242, 219, 219);
                cell1.PreferredWidth = w1;
                cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                s1.FontWeight = FontWeights.Bold;
                s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                s1.Text = "Item";
                p1.Inlines.Add(s1);
                cell1.Blocks.Add(p1);

                p1 = new Paragraph();
                s1 = new Span();
                cell2.Background = Color.FromRgb(242, 219, 219);
                cell2.PreferredWidth = w2;
                cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                s1.FontWeight = FontWeights.Bold;
                s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                s1.Text = subject;
                p1.Inlines.Add(s1);
                cell2.Blocks.Add(p1);

                row.Cells.Add(cell1);
                row.Cells.Add(cell2);
                table.Rows.Add(row);
                int nRow = 0;
                foreach (string name in rowName)
                {
                    row = new TableRow();
                    cell1 = new TableCell();
                    cell2 = new TableCell();
                    switch (nRow)
                    {
                        default:
                            p1 = new Paragraph();
                            s1 = new Span();
                            cell1.Background = Color.FromRgb(255, 255, 255);
                            cell1.PreferredWidth = w1;
                            cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontWeight = FontWeights.Bold;
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = name;
                            p1.Inlines.Add(s1);
                            cell1.Blocks.Add(p1);

                            p1 = new Paragraph();
                            s1 = new Span();
                            cell2.Background = Color.FromRgb(255, 255, 255);
                            cell2.PreferredWidth = w2;
                            cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = " ";
                            p1.Inlines.Add(s1);
                            cell2.Blocks.Add(p1);

                            row.Cells.Add(cell1);
                            row.Cells.Add(cell2);
                            table.Rows.Add(row);
                            break;
                        case 9:
                        case 10:
                        case 12:
                        case 13:
                        case 15:
                        case 16:
                            DocumentList bullets = new DocumentList(DefaultListStyles.Bulleted, doc_text.Document);
                            p1 = new Paragraph();
                            s1 = new Span();
                            cell1.Background = Color.FromRgb(255, 255, 255);
                            cell1.PreferredWidth = w1;
                            cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = name;
                            p1.Inlines.Add(s1);
                            bullets.AddParagraph(p1);
                            cell1.Blocks.Add(p1);

                            p1 = new Paragraph();
                            s1 = new Span();
                            cell2.Background = Color.FromRgb(255, 255, 255);
                            cell2.PreferredWidth = w2;
                            cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = " ";
                            p1.Inlines.Add(s1);
                            cell2.Blocks.Add(p1);

                            row.Cells.Add(cell1);
                            row.Cells.Add(cell2);
                            table.Rows.Add(row);
                            break;
                        case 17:
                            p1 = new Paragraph();
                            s1 = new Span();
                            cell1.Background = Color.FromRgb(255, 255, 255);
                            cell1.PreferredWidth = w1;
                            cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            cell1.RowSpan = 7;
                            s1.FontWeight = FontWeights.Bold;
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = name;
                            p1.Inlines.Add(s1);
                            cell1.Blocks.Add(p1);

                            p1 = new Paragraph();
                            s1 = new Span();
                            cell2.Background = Color.FromRgb(255, 255, 255);
                            cell2.PreferredWidth = w2;
                            cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = " ";
                            p1.Inlines.Add(s1);
                            cell2.Blocks.Add(p1);

                            row.Cells.Add(cell1);
                            row.Cells.Add(cell2);
                            table.Rows.Add(row);
                            for (int x = 0; x < 6; x++)
                            {
                                row = new TableRow();
                                cell2 = new TableCell();
                                p1 = new Paragraph();
                                s1 = new Span();
                                cell2.Background = Color.FromRgb(255, 255, 255);
                                cell2.PreferredWidth = w2;
                                cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                                s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                                s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                                s1.Text = " ";
                                p1.Inlines.Add(s1);
                                cell2.Blocks.Add(p1);
                                row.Cells.Add(cell2);
                                table.Rows.Add(row);
                            }
                            break;
                    }
                    nRow++;

                }
                editor.InsertTable(table);

                // Insert a field so we can identify the type of template
                //var cell = table.EnumerateChildrenOfType<TableCell>().FirstOrDefault();
                var cell = table.EnumerateChildrenOfType<TableCell>().FirstOrDefault();
                if (cell != null)
                {
                    DocumentPosition position = new DocumentPosition(doc_text.Document);
                    position.MoveToDocumentElementStart(cell.Blocks.First());
                    DocumentVariableField docVariable = new DocumentVariableField() { VariableName = "5000" };
                    editor.InsertField(docVariable);
                }
                doc_text.Document.DocumentVariables["5000"] = "";
                var field = doc_text.Document.EnumerateChildrenOfType<FieldRangeStart>().Where(x => x.Field.FieldTypeName == "DOCVARIABLE"
                && ((DocumentVariableField)x.Field).VariableName == "5000").FirstOrDefault();
                if (field != null)
                {
                    doc_text.UpdateField(field);
                }
                // Add the Datepickers
                var hrow5 = table.EnumerateChildrenOfType<TableRow>().ToList()[5];
                var hrow6 = table.EnumerateChildrenOfType<TableRow>().ToList()[6];
                var hrow17 = table.EnumerateChildrenOfType<TableRow>().ToList()[17];
                AddPurchaseDatePicker(table, hrow5);
                AddPurchaseDatePicker(table, hrow6);
                AddPurchaseDatePicker(table, hrow17);
            }
            catch (Exception e)
            {
                CGlobals cg = new CGlobals();
                cg.ShowError("TemplateHandler:PurchaseTemplate Error\n" + e.Message, 3);

            }
        }

We are then trying to insert a DateProperties into 3 cells in the table created using AddPurchaseDatePicker(Table, TableRow) :


        public void AddPurchaseDatePicker(Table table, TableRow row)
        {
            try
            {
                RadDocument document = doc_text.Document;
                RadDocumentEditor editor = new RadDocumentEditor(document);
                var dateCell = row.Cells.ToList()[1];
                DocumentPosition position = new DocumentPosition(document);
                string dateVal = string.Empty;

                var span = dateCell.EnumerateChildrenOfType<Span>().FirstOrDefault();
                if (span != null)
                {
                    dateVal = span.Text;
                    span.Text = " ";
                }
                position.MoveToDocumentElementStart(dateCell.Blocks.First());
                document.CaretPosition.MoveToPosition(position);
                editor.ChangeFontFamily(new FontFamily(CGlobals.docu_default_font));
                editor.ChangeFontSize(Unit.PointToDip(CGlobals.docu_default_font_size));
                DateProperties dataProperties = new DateProperties();
                try
                {
                    dataProperties.FullDate = DateTime.Parse(dateVal);
                }
                catch { }
               
                dataProperties.IsTemporary = false;
                dataProperties.StyleName = "TemplateFields";
                editor.InsertStructuredDocumentTag(dataProperties);
                doc_text.Document = document;
                table.Rows.ElementAdded += doc_text_NoteChanged;
            }
            catch { }
        }

When we try and set the CaretPosition with 

document.CaretPosition.MoveToPosition(position);

we recieve the following exception:

System.InvalidOperationException
  HResult=0x80131509
  Message=inline does not belong to this document.
  Source=Telerik.Windows.Controls.RichTextBox
  StackTrace:
   at Telerik.Windows.Documents.Model.RadDocument.GetContainingAnnotationRanges[TRangeStart](Inline inline, Predicate`1 filter, Boolean inclusive)
   at Telerik.Windows.Documents.Model.RadDocument.GetContainingAnnotationRanges[TRangeStart](Inline inline, Boolean inclusive)
   at Telerik.Windows.Documents.DocumentPosition.get_IsPositionInSkipPositionRange()
   at Telerik.Windows.Documents.DocumentPosition.get_IsValidPosition()
   at Telerik.Windows.Documents.DocumentPosition.Validator.EnsureValidPosition(DocumentPosition position, Func`1 shouldSearchForward)
   at Telerik.Windows.Documents.DocumentPosition.OnPositionChanged()
   at Telerik.Windows.Documents.Utils.SuspendChangingAndChangedActionCounter.InvokeChangedActionInternal()
   at Telerik.Windows.Documents.Utils.SuspendChangingAndChangedActionCounter.InvokeChanged()
   at Telerik.Windows.Documents.DocumentPosition.MoveToPosition(DocumentPosition newPosition)
   at DocuPraxis.MainWindow.AddPurchaseDatePicker(Table table, TableRow row) in E:\Source\Repos\Panarc\DocuPraxisTel\DocuPraxis\DocuPraxisTemplateHandler.cs:line 1634

We are using a similar method to add DateProperties in other generated documents without problem, e.g.:


        public void AddNotesDatePicker(Table table, TableRow row)
        {
            try
            {
                RadDocument document = doc_text.Document;
                RadDocumentEditor editor = new RadDocumentEditor(document);
                var dateCell = row.Cells.ToList()[0];
                DocumentPosition position = new DocumentPosition(document);
                string dateVal = string.Empty;
                
                var span = dateCell.EnumerateChildrenOfType<Span>().FirstOrDefault();
                if (span != null)
                {
                    dateVal = span.Text;
                    if(String.IsNullOrEmpty(dateVal) || dateVal == " " )
                    {
                        dateVal = DateTime.Now.ToString("dd/MM/yyyy");
                    }
                    span.Text = " ";
                }
                position.MoveToDocumentElementStart(dateCell.Blocks.First());
                document.CaretPosition.MoveToPosition(position);
                editor.ChangeFontFamily(new FontFamily(CGlobals.docu_default_font));
                editor.ChangeFontSize(Unit.PointToDip(CGlobals.docu_default_font_size));
                DateProperties dataProperties = new DateProperties();
                dataProperties.FullDate = DateTime.Parse(dateVal);
                dataProperties.IsTemporary = false;
                dataProperties.StyleName = "TemplateFields";
                editor.InsertStructuredDocumentTag(dataProperties);
                doc_text.Document = document;
                table.Rows.ElementAdded += doc_text_NoteChanged;
            }
            catch { }
        }
What are we doing wrong?
Dimitar
Telerik team
 answered on 07 Oct 2024
0 answers
14 views

hi

I was using RadWindow as my main window.

it was correctly in the 2019 version but after updating to the new version the preview stopped showing.

What should I do to solve the problem?

------------------------------------------------

i found my answer in https://docs.telerik.com/devtools/wpf/controls/radwindow/how-to/use-radwindow-as-user-control

i must add

Style="{StaticResource RadWindowStyle}" 

to radwindow prperty

smr
Top achievements
Rank 1
 updated question on 06 Oct 2024
0 answers
12 views

Hi Team,

I need to stop refreshing once the filter is applied.

Example.I have lot of items in one panel ,If I selected item1 in that panel and applied filter in the RadPropertyGrid  for some fields.

And then I will select sencond item in the grid.Now,the RadPropertyGrid  should display the filtered fields but it showing entire fileds.

How to achieve this.

Or give me a solution to set the text for the searchasyoutype textbox from codebehind

 

Kanagaraj
Top achievements
Rank 1
 asked on 04 Oct 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
n
Top achievements
Rank 1
Iron
Iron
Arifullah
Top achievements
Rank 2
Iron
Iron
Marat
Top achievements
Rank 1
Richard
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 2
Iron
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
n
Top achievements
Rank 1
Iron
Iron
Arifullah
Top achievements
Rank 2
Iron
Iron
Marat
Top achievements
Rank 1
Richard
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 2
Iron
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?