Telerik Forums
UI for WPF Forum
1 answer
314 views

Hi,

We have a series of views consisting of a search box, search options and then a results RadGridView. Since the functionality & bindings is the same on each, we have a UserControl that holds the search box & search options functionality. The only difference between each view is the Columns in RadGridView, so we are trying to put the RadGridView inside the UserControl and allow the columns to be specified by the implementing view.

Do you know how we could achieve this?

Roughly what we're trying to do:

 <UserControl x:Class="UserControls.BaseSearch" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Height="Auto"  Width="Auto"> 
<Grid> 
<telerik:RadGridView Margin="0" Name="radGridView1" ItemsSource="{Binding SearchResults}" /> 
</Grid> 
</UserControl> 

<UserControl x:Class="Views.CustomerSearch" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:userControls="http://schemas.telerik.com/2008/xaml/presentation" 

    Height="Auto"  Width="Auto"> 
    <Grid> 
<userControls:BaseSearch>
<telerik:RadGridView.Columns>

<telerik:GridViewDataColumn Header="Reference"
Name="Reference"
DataMemberBinding="{Binding Reference}" Width="100">
</telerik:GridViewDataColumn>

<telerik:GridViewDataColumn Header="Description"
DataMemberBinding="{Binding Description}"
Width="200" />

<telerik:GridViewDataColumn Header="Start Date"
DataMemberBinding="{Binding StartDate, StringFormat=d}"
ShowDistinctFilters="False"
Width="130" />

</telerik:RadGridView.Columns>
</userControls:BaseSearch>
    </Grid> 
</UserControl> 

 

 

 

Vladimir Stoyanov
Telerik team
 answered on 26 Aug 2020
3 answers
99 views

I have a RadGridView which contains one column which is for input, and this column contains a CellEditTemplate with several fields for input, like name, middle names and surname.

Name and surname must not be empty for the validation to pass. When I click to add new row, the form with these fields appear in view and I can edit them.

If I add text for the mandatory fields, name and surname and then click on other column in this new row, the validation passes and form collapses, which makes the row look as saved when its not.

This could have two solutions, either tell the user that the row is still in edit mode and its not saved, or just prevent the form from collapsing.

How can I do both things for example?

Display message that the row is still in edit mode, and prevent the form from collapsing if it is still in edit mode?

 

Note: I have cell validating event set, and also name and surname have "Required" data annotation attribute.

Dilyan Traykov
Telerik team
 answered on 25 Aug 2020
1 answer
804 views

Hello

Does Telerik UI for WPF have Stepper Control like Stepper in Telerik UI for ASP.NET Core?

Thanks in advanced
Abdulsalam

Martin Ivanov
Telerik team
 answered on 24 Aug 2020
0 answers
110 views

I have a ScheduleView control and I am using a GroupHeaderContentTemplateSelector and a ResourceTypeCollection to display 3 groups:

<scheduleView:ResourceTypeCollection x:Key="ResourcesTypes">
    <scheduleView:ResourceType Name="Schedule">
        <scheduleView:Resource ResourceName="ScheduleOrder" DisplayName="Orders" />
        <scheduleView:Resource ResourceName="ScheduleHeat" DisplayName="Heats" />
        <scheduleView:Resource ResourceName="ScheduleTundish" DisplayName="Tundishes" />
    </scheduleView:ResourceType>
</scheduleView:ResourceTypeCollection>

 

<localStyles:CustomGroupHeaderContentTemplateSelector x:Key="CustomGroupHeaderContentTemplateSelector">
    <localStyles:CustomGroupHeaderContentTemplateSelector.HorizontalTemplate>
        <DataTemplate>
            <ContentPresenter Content="{Binding FormattedName}" Margin="2" Width="80" Height="30" VerticalAlignment="Center"/>
        </DataTemplate>
    </localStyles:CustomGroupHeaderContentTemplateSelector.HorizontalTemplate>
 
    <localStyles:CustomGroupHeaderContentTemplateSelector.VerticalTemplate>
        <DataTemplate>
            <telerik:LayoutTransformControl VerticalAlignment="Center">
                <telerik:LayoutTransformControl.LayoutTransform>
                    <RotateTransform Angle="0" />
                </telerik:LayoutTransformControl.LayoutTransform>
                <ContentPresenter Content="{Binding FormattedName}" Margin="5" Width="70"/>
            </telerik:LayoutTransformControl>
        </DataTemplate>
    </localStyles:CustomGroupHeaderContentTemplateSelector.VerticalTemplate>
 
    <localStyles:CustomGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
        <DataTemplate>
            <ContentPresenter Content="{Binding Name.DisplayName}" Margin="2" Width="80" Height="30" VerticalAlignment="Center"/>
        </DataTemplate>
    </localStyles:CustomGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
 
    <localStyles:CustomGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
        <DataTemplate>
            <telerik:LayoutTransformControl VerticalAlignment="Center">
                <telerik:LayoutTransformControl.LayoutTransform>
                    <RotateTransform Angle="0" />
                </telerik:LayoutTransformControl.LayoutTransform>
                <ContentPresenter Content="{Binding FormattedName}" Margin="5" Width="60" Height="23" MaxHeight="23" MinHeight="23"/>
            </telerik:LayoutTransformControl>
        </DataTemplate>
    </localStyles:CustomGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
     
</localStyles:CustomGroupHeaderContentTemplateSelector>

<scheduleView:RadScheduleView x:Name="scheduleViewOrders" Grid.RowSpan="2"
                              BorderThickness="0 1 1 1"
                              MinAppointmentHeight="20"           
                              FirstVisibleTime="00:00"
                              GroupHeaderContentTemplateSelector="{StaticResource CustomGroupHeaderContentTemplateSelector}"
                              AppointmentItemContentTemplate="{ StaticResource AppointmentTemplate}"
                              ResourceTypesSource="{StaticResource ResourcesTypes}"                                                             
                              ShowAppointmentDeleteButton="False"
                              ShowCurrentTimeIndicator="False"
                              HorizontalScrollBarVisibility="Visible">
    <scheduleView:RadScheduleView.ActiveViewDefinition>
        <scheduleView:DayViewDefinition GroupFilter="{Binding GroupFilter}" Orientation="Horizontal" VisibleDays="10" MinorTickLength="1h"
                                        MajorTickLength="1h" MinTimeRulerExtent="3000"/>
    </scheduleView:RadScheduleView.ActiveViewDefinition>                                   
    <scheduleView:RadScheduleView.GroupDescriptionsSource>
        <scheduleView:GroupDescriptionCollection>
            <scheduleView:DateGroupDescription></scheduleView:DateGroupDescription>
            <scheduleView:ResourceGroupDescription ResourceType="Schedule" />
        </scheduleView:GroupDescriptionCollection>
    </scheduleView:RadScheduleView.GroupDescriptionsSource>    
</scheduleView:RadScheduleView>

 

Now, the problem that I have is next: when I start the application there is no information to display (Image1), then I select a different day, where there is information, but something weird is happening, I can see only one row, the groups have disappeared along with the days (Image2) only after I scroll a little bit everything goes back to normal (Image3).

I am not sure what is happening, have you seen this behavior before?

 

Amige
Top achievements
Rank 1
Veteran
 asked on 21 Aug 2020
2 answers
181 views

Hi,

I tried adding a node and a link to the GraphSource. It worked but after this operation, the diagram layout seems to have been reset even though the AutoLayout property is set to True.

MainWindow.xaml.cs

using System;
using System.Windows;
using radDiagramTest.ViewModels;
using Telerik.Windows.Diagrams.Core;

namespace radDiagramTest
{
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();

      ClassificationGraphViewModel viewModel = RootGrid.Resources["ViewModel"] as ClassificationGraphViewModel;

      ClassificationDiagram.GraphSource = viewModel?.GraphSource;

      ClassificationDiagram.Loaded += ClassificationDiagram_Loaded;
      ClassificationDiagram.AutoFit( new Thickness( 10 ), false );
    }

    private void ClassificationDiagram_Loaded( Object _sender, RoutedEventArgs _e )
    {
      TreeLayoutSettings settings = new TreeLayoutSettings
      {
        TreeLayoutType = TreeLayoutType.TreeDown,
        HorizontalSeparation = 300d,
        VerticalSeparation = 75d
      };

      settings.Roots.Add( ClassificationDiagram.Shapes[0] );

      ClassificationDiagram.Layout( LayoutType.Tree, settings );
      ClassificationDiagram.AutoLayout = true;
      ClassificationDiagram.IsEditable = false;
    }
  }
}

NodeViewModel.cs (node custom view model where the Add button is)

using System;
using System.Windows;
using System.Windows.Input;
using radDiagramTest.ViewModels;
using Telerik.Windows.Controls.Diagrams.Extensions.ViewModels;

namespace radDiagramTest
{
  public class NodeViewModel : HierarchicalNodeViewModel
  {
    public NodeViewModel( ClassificationGraphViewModel _parent )
    {
      m_Parent = _parent;

      AddNodeCommand = new SimpleCommand( AddNodeCommandHandler );
    }

    public ICommand AddNodeCommand { get; set; }
    public String Name { get; set; }

    private void AddNodeCommandHandler()
    {
      NodeViewModel newNode = new NodeViewModel( m_Parent ) { Name = "New Node" };
      m_Parent.GraphSource.AddNode( newNode );

      LinkViewModel newLink = new LinkViewModel( this, newNode ) { Name = "New Edge" };
      m_Parent.GraphSource.AddLink( newLink );
    }

    private readonly ClassificationGraphViewModel m_Parent;
  }
}

Dominik
Top achievements
Rank 1
 answered on 21 Aug 2020
1 answer
207 views

Hi,I'm Using Custom Shape  and I want to Add a ListBox to the SettingsPaneView and Bind the shape's ViewModel to the Listbox ,but the data now show ,Anybody can help me,Thanks.

 

private List<AdjacentSpace6VM> _AdjacentSpaces;
 
    public List<AdjacentSpace6VM> AdjacentSpaces
    {
        get
        {
            return _AdjacentSpaces;
        }
        set
        {
            _AdjacentSpaces = value;
            OnPropertyChanged(() => this.AdjacentSpaces);
        }
    }
<ListBox extensions:SettingsPaneView.EditorPropertyName="DataContext.AdjacentSpaces" extensions:SettingsPaneView.EditorItemType="Shapes,Custom, Connections" extensions:SettingsPaneView.EditorValue="{Binding Path=ItemsSource, Mode=TwoWay, RelativeSource={RelativeSource Self}}" Grid.Row="3" Grid.ColumnSpan="2">
                      <ListBox.ItemsPanel>
                          <ItemsPanelTemplate>
                              <UniformGrid Columns="3" IsItemsHost="True" Margin="0" />
                          </ItemsPanelTemplate>
                      </ListBox.ItemsPanel>
                      <ListBox.ItemContainerStyle>
                          <Style TargetType="{x:Type ListBoxItem}">
                              <Setter Property="Template">
                                  <Setter.Value>
                                      <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                          <Grid>
                                              <Grid.ColumnDefinitions>
                                                  <ColumnDefinition></ColumnDefinition>
                                                  <ColumnDefinition></ColumnDefinition>
                                              </Grid.ColumnDefinitions>
                                              <TextBlock Grid.Column="0" Text="{Binding Number}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="30" Margin="30 10 0 20" Foreground="White"></TextBlock>
                                              <TextBlock Grid.Column="1" Text="{Binding CT}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="30" Margin="10 10 30 20" Foreground="White"></TextBlock>
                                              <TextBlock Grid.Column="1" Text="aaa" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="30" Margin="10 10 30 20" Foreground="White"></TextBlock>
                                          </Grid>
                                      </ControlTemplate>
                                  </Setter.Value>
                              </Setter>
                          </Style>
                      </ListBox.ItemContainerStyle>
                  </ListBox>
Vladimir Stoyanov
Telerik team
 answered on 21 Aug 2020
2 answers
74 views

Hey,

I have a few RadGridViews with editable data.
If someone now edits a value and commits the changes with the Return key, it does save the changes as expected. But also it jumps to the next row and starts the edit of the same column in this row.

Is it possible to disable this behaviour? So it may jump to the next row, but not starts the Edit Mode on it?

 

Greetings

Benedikt

Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 21 Aug 2020
1 answer
199 views

Hi,

 

I have a grouped GridView, which have many aggregate functions attached. Group headers showing some of the aggregate function results. 

When the user clicks a column header she expects grid to sort by aggregate results by group headers but the grid sorting by the original data source without group. This confuses our users.

 

Is there a way to sort gridview by group header aggregate results ? 

 

Thank you in advance.

Dilyan Traykov
Telerik team
 answered on 21 Aug 2020
1 answer
63 views

Hello,

I use the property Selection & Periodstart to change values in background.
Now I want to find out, what the user selected, but I cant find the difference.

I also tried to change ActualSelectionChanged it also gets triggered by user & background.

Is there any event which only triggers by user?

Regards

Dilyan Traykov
Telerik team
 answered on 20 Aug 2020
5 answers
1.3K+ views

I have a GridViewDataColumn declared as below in XAML. 

                    <telerik:GridViewDataColumn DataMemberBinding="{Binding L3Size, StringFormat='0'}"  UniqueName="L3Size"<br>IsReadOnly="True" <br>SortMemberPath="L3Size" Width="60" CellStyleSelector="{StaticResource L3SizeStyler}" ><br>                        <telerik:GridViewDataColumn.Header><br>                            <TextBlock Text="L3 Sz" TextWrapping="Wrap" Style="{StaticResource TextBlockWhite}" /><br>                        </telerik:GridViewDataColumn.Header><br>                    </telerik:GridViewDataColumn><br>

 

A filter is applied on the grid for L3Size > 0 and it works fine.  L3Size for one of the rows becomes 0 and the value is correctly displayed as 0 on the grid. 

L3Size is set to 0 in the viewmodel. But that row doesnt get filtered out.

Any idea why its happening ?

 

Vladimir Stoyanov
Telerik team
 answered on 20 Aug 2020
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?