Telerik Forums
UI for WPF Forum
3 answers
246 views

Hello,

    I am trying to create view containing collection of items with with specified Row, RowSpan, Coulumn and ColumnSpan properties in RadTileView. So far I've created VM ParamsEditionViewModel containing observable collection of BindableProfileData, which wraps 

public class BindableProfileData : BindableBase
    {
        
        private ProfileItem _profileModel;
        private BindableDPDataItem _dataModel;
 
        public int Row
        {
            get { return _profileModel.DrawingSettings.Row; }
        }
 
        public int Column
        {
            get
            {
                return _profileModel.DrawingSettings.Column;
            }
        }
         
        public int RowSpan
        {
            get { return _profileModel.DrawingSettings.RowSpan; }
        }
 
         
 
        public int ColumnSpan
        {
            get { return _profileModel.DrawingSettings.ColumnSpan; }
        }
}

 

To make possible settings custom tiles size I used MultipleRowsAndColumnsPanel provided by You in one of RadGridView developers examples (link).

Whole view looks like this:

<Grid>
      <FrameworkElement.Resources>
            <DataTemplate x:Key="ItemTemplate" >
                <TextBlock Text="{Binding Name}" />
            </DataTemplate>
 
            <DataTemplate x:Key="ContentTemplate">
                <StackPanel>
                    <TextBlock Text="{Binding Row, StringFormat='Row: {0}'}"/>
                    <TextBlock Text="{Binding Column, StringFormat='Column: {0}'}"/>
                    <TextBlock Text="{Binding RowSpan, StringFormat='RowSpan: {0}'}"/>
                    <TextBlock Text="{Binding ColumnSpan, StringFormat='ColumnSpan: {0}'}"/>
                </StackPanel>
            </DataTemplate>
        </FrameworkElement.Resources>
        <Grid>
            <telerik:RadTileView x:Name="xTileView"
                             ItemTemplate="{StaticResource ItemTemplate}"
                             ContentTemplate="{StaticResource ContentTemplate}"
                             ItemsSource="{Binding SelectedCategory}"
                             IsAutoScrollingEnabled="True"
                             ColumnWidth="500"
                             RowHeight="300">
 
                <telerik:RadTileView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <controlls:MultipleRowsAndColumnsPanel RowsCount="4" ColumnsCount="3"/>
                    </ItemsPanelTemplate>
                </telerik:RadTileView.ItemsPanel>
                <telerik:RadTileView.ItemContainerStyle>
                    <Style TargetType="telerik:RadTileViewItem">
                        <Setter Property="controlls:TileViewAttachedProperties.Row" Value="{Binding Row}"/>
                        <Setter Property="controlls:TileViewAttachedProperties.Column" Value="{Binding Column}"/>
                        <Setter Property="controlls:TileViewAttachedProperties.RowSpan" Value="{Binding RowSpan}"/>
                        <Setter Property="controlls:TileViewAttachedProperties.ColumnSpan" Value="{Binding ColumnSpan}"/>
                    </Style>
                </telerik:RadTileView.ItemContainerStyle>
            </telerik:RadTileView>
        </Grid>
    </Grid>

 

The problem is that the view don't appears when I load collection to VM after button click. When I remove this block 

<telerik:RadTileView.ItemsPanel>
        <ItemsPanelTemplate>
             <controlls:MultipleRowsAndColumnsPanel RowsCount="4" ColumnsCount="3"/>
        </ItemsPanelTemplate>
</telerik:RadTileView.ItemsPanel>

The view appears but of course not if a expected format. When I paste ItemsPanel block when app is running with (Edit and Continue mode in VS), view looks just how it should be. So I have two questions. How to fix this issue and second how can I uprgrade view to load different data templates if VM observable collection contains different objects inheritating from base BindableProfileData.

Dinko | Tech Support Engineer
Telerik team
 answered on 08 Jan 2020
3 answers
502 views

I'm trying to use RadPdfViewer in my WPF app but it seems unwieldy.  I am wondering if I misunderstand it.

With the normal WPF DocumentViewer and FixedDocument, I can lay out a page in XAML just as I want it and then just add that the the FixedDocument.  Can I do this with RadPdfViewer?   

Every example I see (in the PdfProcessing examples) has the user creating text blocks, tables and annotations in code-behind and then individually adding them to RadFixedPages.  That completely defeats the purpose of using WPF in the first place.  I don't want to lay out a report in code-behind.  I want to lay out out a XAML page and add it to the report.

But since this stuff comes with your UI for WPF, I assume I must be missing something fundamental.

To be explicit, here is what I do right now when the user tries to generate a report. 

  • I start off with a view model "PageVm"
  • The main report is laid out in ReportView.xaml .
  • I've already laid out my report pages with ReportPageView.xaml

 

// Code behind of ReportView.xaml.cs
         
private void GenerateViewerDoc(ReportPageVm page,Vm Size pageSize)
{

     // Create the document, PageView

    var doc = new FixedDocument();
    var rc = new ReportPageView { DataContext    = pageVm  };
    doc.DocumentPaginator.PageSize = pageSize;
    var content = new PageContent() { DataContext = pageVm };
 
    var page = new FixedPage  {  DataContext = pageVm };
 
    page.Children.Add(rc);
    ((IAddChild)content).AddChild(page);
    doc.Pages.Add(content);
             
     // Put this new document into the Document Viewer (which is declared in XAML)
     Viewer.Document = doc;
 }

 

Is this possible with Telerik's UI?  How do I do it?

 

Dimitar
Telerik team
 answered on 08 Jan 2020
1 answer
96 views

In the Search Location article, I've successfully tried out both Examples 2 and 3.  Each of them use SearchLocationAsync to make the request and restProvider_SearchLocationCompleted to handle the return.  In my app, I'd like to provide the user with the ability to search by address or location, and to do other things, too, but it looks like there can be only one implementation of restProvider_SearchLocationCompleted.  Of course, each request will need its own handling of the return, so how is that best accomplished?

I noticed that BingRestSearchLocationCompletedEventArgs has a UserData property that's an Object, so I assume the caller can create an object of their own design, populate it as desired and have it returned through this property.  If so, I could include an enum which my handler could use to determine how to process the return, which would solve my need.

The problem I'm having, though, is that I don't know how to send that UserData object along with my request.  There doesn't seem to be a parameter in the BingRestSearchLocation method that would allow me to.

So, I have two questions:

1. Is what I'm suggesting the normal way of handling this?  If not, what is normally done?

2. How does one send UserData in the request, so that it comes through in the completion handler?

Ken
Top achievements
Rank 1
 answered on 07 Jan 2020
3 answers
94 views

I am using the ScheduleView control to build a program that will replace a spreadsheet my coworkers and I currently use to coordinate our field work. Here is a summary of the information for each appointment I want to display:

  • Supervisor initials
  • Which of our crews you are supervising
  • Which shift you are covering (day/night)
  • Shift start
  • Shift end

I am going to have each appointment item be colored by which crew, but I am looking for a custom behavior with how "Shifts" work in the program. The start/stop times of each shift never change. Instead, we work either "Day" or "Night" shift. Because of this, the ScheduleView control will always be in MonthView format.

I am looking for a good way essentially split each day on the MonthView into a "day" and "night" section, whether by a time range (12am-12pm & 12pm-11:59pm), or by some kind of special container that is categorized as "Day" or "Night". Then when we add an assignment inside the "Night" container, or on the night half of the cell, the code would be able to automatically set that record's "Shift" field to "Night", or visa versa for days.

What would be the best way to do this? I have looked at custom containers, but I can't find an example that shows what I am wanting. I have included an image showing what I would want it to look like.

Users will need to be able to drag/drop their assignments around to trade shifts, and users will need to be able to click the "Day" or "Night" containers to add new shift assignments.

I am also open to any suggestions that someone may have on a better way to display this information.

Thank you for any feedback/help!

Dinko | Tech Support Engineer
Telerik team
 answered on 06 Jan 2020
0 answers
126 views

Hi Progress Telerik,

We are using RadAutoCompleteBox for WPF.

Sometimes, while searching with Text, it displays with improper UI.

It is happening very rarely or at least once in a day.

Please find the attachment.

Kindly suggest on this.

 

Below is the code used in xaml:

<tk:RadAutoCompleteBox
                        Name="CountryRadComboBox"
                        Grid.Column="1"
                        VerticalAlignment="Center"
                        DropDownItemTemplate="{StaticResource CountryNameTemplate}"
                        ItemsSource="{Binding CountryList}"
                        SearchText="{Binding CountryTextChanged, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        SelectedItem="{Binding SelectedCountry, Mode=TwoWay, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"
                        SelectionMode="Single"
                        TextSearchMode="Contains"
                        TextSearchPath="Description">
      <tk:RadAutoCompleteBox.FilteringBehavior>
           <tk:AsyncFilteringBehavior />
      </tk:RadAutoCompleteBox.FilteringBehavior>
</tk:RadAutoCompleteBox>

 

Thanks and Regards,

Muhammad Azhar Shah

Azharshah
Top achievements
Rank 1
 asked on 06 Jan 2020
3 answers
365 views

I have a web application that is using your Kendo editor.  The HTML output of the Kendo editor is saved in a database and can be opened in another WPF application to be edited in a RadRichTextBox.  The HTML is imported as follows, where "editor" is a RadRichTextBox:

private void ImportHtml(string HTML)
{
    HtmlFormatProvider _provider = new HtmlFormatProvider();
    HtmlImportSettings settings = new HtmlImportSettings();
 
    _provider.ImportSettings = settings;
    settings.UseDefaultStylesheetForFontProperties = true;
   editor.Document = _provider.Import(HTML);
}

 

When tables are created in the Kendo editor and imported to the RadRichTextBox, several issues are seen:

  1. Table, row, and cell heights are not maintained.  All rows and cells become the same height.
  2. Cell padding is not correct.  I can see the padding in the imported HTML as <td style="padding:5px;", but after import the padding is changed to padding: 5px 0px 0px 0px; (Padding="0,5,0,0" in the XAML).
  3. Table borders are not visible.  The borders are still in the HTML and can be seen in the Table Borders properties dialog, but are not visible in the editor and seem to not always work correctly if modified in the Table Borders properties dialog.  If cell spacing is added to the table in Kendo, then the borders will display in WPF.  Therefore, it appears as if the outer cell borders are covering the table borders.

Please let me know if there is anything I am missing here that will provide proper display of the tables in the RadRichTextBox.

Thanks!

Georgi
Telerik team
 answered on 03 Jan 2020
2 answers
784 views

Hi,

I'm working with the RadSyntaxEditor (WPF R3 2019) and loving it. It is a great control with lots of potential for our team.

 

The issue I have is simple and I feel silly having to ask something so trivial, but is there a way access the underlying text of the TextDocument? We need it to write to a stream and save the document after editing. I've tried looking in the TextDocument and TextSnapShot objects, iterating all the lines and spans, and calling all their ToString() methods, but nothing seemed to work. Is there a way to access the raw text from the rope, or even the rope itself?

 

Thank you ahead of time for your help,

Happy New Year.

Tim

Tim
Top achievements
Rank 1
 answered on 03 Jan 2020
4 answers
124 views
I was able to bind a model's text and tooltip to the SelectionBoxTemplate. However, sometimes the tooltip is empty and sometimes it is populated.
However, without a datatrigger in place, even on the empty tooltips, I see an empty tooltip window popup which is a bit of annoyance. Any possible way to fix this?
John
Top achievements
Rank 1
 answered on 02 Jan 2020
8 answers
176 views

Hi,

I am trying to drop shape into a container shape, but the shape is not displaying inside the container. Could anyone help me solve it? Here is my code.

 

EventManager.RegisterClassHandler(typeof(RadDiagramContainerShape), RadDiagramShape.DropEvent, new System.Windows.DragEventHandler(OnDrop));

 

 

private void OnDrop(object sender, System.Windows.DragEventArgs e)
        {
            e.Handled = true;
            if ((e.Data as DataObject)?.GetData(typeof(DragObject)) is DragObject dragObject)
            {
                var itemBase = (ActivityBase)Activator.CreateInstance(dragObject.ContentType);
                var p = e.GetPosition(MainDiagram);
                var shape= createDiagramShape(itemBase);
 
                RadDiagramContainerShape target = (sender as RadDiagramContainerShape);
                target.Items.Add(shape);
            }
        }
 
 
private RadDiagramShape createDiagramShape(ActivityBase activity)
        {
            var shape = new RadDiagramShape
            {
                Content = activity,
                BorderThickness = new Thickness(1),
                UseGlidingConnector = true,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment = VerticalAlignment.Stretch,
                DataContext = activity,
                UseDefaultConnectors = false,
                IsRotationEnabled = false,
                 
                Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)),
                GlidingStyle = GlidingStyle.Rectangle
            };
 
            var outconnector = new InOutConnector
            {
                Offset = new Point(1, 0.2),
                Direction = eDirection.drOut,
                Name = "out" + DateTime.Now.Millisecond
            };
            shape.Connectors.Add(outconnector);
 
            var inconnector = new InOutConnector
            {
                Offset = new Point(0, 0.2),
                Direction = eDirection.drIn,
                Name = "in" + DateTime.Now.Millisecond,
            };
            shape.Connectors.Add(inconnector);
            return shape;
        }

 

 

The following function to drop shape inside the diagram works.

private void OnDropShape(object sender, DragEventArgs e)
        {
            e.Handled = true;
            if ((e.Data as DataObject)?.GetData(typeof(DragObject)) is DragObject dragObject)
            {
                var itemBase = (ActivityBase) Activator.CreateInstance(dragObject.ContentType);
                var p = e.GetPosition(MainDiagram);
                var shape = createDiagramShape(itemBase);
 
                MainDiagram.AddShape(shape, MainDiagram.GetTransformedPoint(p));
                _mainViewModel.ShapeCollection = MainDiagram.Shapes;
                _mainViewModel.SelectedActivity = calendar.DataContext as ActivityBase;
                 
            }
        }

 

 

Thanks,

Rahul

Martin Ivanov
Telerik team
 answered on 02 Jan 2020
1 answer
91 views

If there is only one wizardpage in the WizardPages collection, the AllowFinish property is ignored completely and the Finish button is enabled even if set to false directly or using a binding.

 

Using the latest version of UI for WPF.


Martin Ivanov
Telerik team
 answered on 01 Jan 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?