Telerik Forums
UI for WPF Forum
2 answers
647 views

I have a window with a TabControl that has three TabItems. This TabControl is the main control in the window, and I want to size the window based on this TabControl.

If I set SizeToContent="WidthAndHeight" on the window, the window changes size when I select a tab which has content that takes more area. I want the window to start at a fixed size based on the TabItem that will take the largest amount of space. This is not the starting tab.

A TabItem's ActualWidth is the width of the button. The content of an inactive TabItem (a grid) has an ActualWidth of 0 and a Width of NaN because it is not being displayed.

How can I set the window to a fixed size based on the content of the largest TabItem, which is not selected? This would preferably happen at Window_Loaded or Window_ContentRendered.

Nathan
Top achievements
Rank 1
 answered on 13 Nov 2017
1 answer
179 views

I've got the following radgridview control with a default sort descriptor on it:

<telerik:RadGridView x:Name="rgvMain" VerticalAlignment="Top" AutoGenerateColumns="False" CanUserResizeRows="False" CanUserInsertRows="False" CanUserSortGroups="False" ShowGroupPanel="False"
                        RowIndicatorVisibility="Collapsed" ItemsSource="{Binding CurrentActivities}" Visibility="{Binding CurrentActivitiesVisibility}">
       <telerik:RadGridView.Columns>
         <telerik:GridViewDataColumn DataMemberBinding="{Binding DateAndTimeLogged}" Header="Date Logged" UniqueName="LogDate" Width="Auto" IsReadOnly="True" />
         <telerik:GridViewDataColumn DataMemberBinding="{Binding TypeDescription}" Header="Type" UniqueName="TypeDescription" Width="Auto" IsReadOnly="True"/>
         <telerik:GridViewDataColumn DataMemberBinding="{Binding ActivityStudent.FullName}" Header="Student" UniqueName="StudentName" Width="Auto" IsReadOnly="True" />
         <telerik:GridViewDataColumn DataMemberBinding="{Binding ActivityStudent.Family.Name}" Header="Family" UniqueName="FamilyName" Width="Auto" IsReadOnly="True"/>
         <telerik:GridViewDataColumn DataMemberBinding="{Binding ActivityText}" Header="Report" UniqueName="Report" Width="Auto" IsReadOnly="True"/>
       </telerik:RadGridView.Columns>
       <telerik:RadGridView.SortDescriptors>
         <telerik:ColumnSortDescriptor Column="{Binding Columns[LogDate], ElementName=rgvMain}" SortDirection="Descending"/>
       </telerik:RadGridView.SortDescriptors>
     </telerik:RadGridView>

 

The ItemsSource is bound to:

public ObservableCollection<Activity> CurrentActivities
{
  get { return new ObservableCollection<Activity>(Utils.AllActivities.Where(x => x.LoggedUser == Utils.glbCurrentlyLoggedInUser)); }
}

 

Whenever the usercontrol is first loaded - the sortdescriptors work, but then any future loads of the usercontrol, the sortdescriptors/filters get lost - I've tried adding a Rebind to the GV on the usercontrol loaded but this doesn't make a difference.

Martin
Telerik team
 answered on 13 Nov 2017
15 answers
451 views
Hi,

We are looking for a control which we can use for searching through multiple columns in a combo box. Use case is...as user types into the combo box, the data in the combo box should be auto filtered and when user selects a row using up/down keys and press enter, current row should be selected.

I can see that Telerik has a similar control for winforms but I am wondering if we have similar control for WPF too.

In our application we uses controls from 2 different vendors, where one vendor is telerik. I will check the availability of the similar control with other vendor too. But if Terelik can provide us such a inbuild control then it will be easy for us to move to Telerik only controls in future.

Thanks,
SK
Bent
Top achievements
Rank 1
 answered on 13 Nov 2017
1 answer
101 views

Hi,

 

We started toreplace our controls by telerik ones and noticed that the combobox wasn't getting the background of the theme we are using (Office 2016). It was keeping a gray gradient background.

 

After some investigation with the XAML forTelerik.Windows.Control.Input, the style for NonEditableComboBox consists of a grid with two borders and a RadToggleButton inside of it.

 

After some investigation, I noticed that adding the following lines to the toggle fixed my problem:

Background="{TemplateBinding Background}"
Height="{TemplateBinding Height}"

(Height had to be added for the highlight border as well)

Is this a bug? Or the expected behavior is that when using a RadComboBox the developer wont be able to get the background from the theme or be able to set the height?

Thanks!

 

 

 

Martin
Telerik team
 answered on 13 Nov 2017
1 answer
151 views

Radgridview ist filled with data from database. CRUD works fine.

The RadGridview doesn`t show any changes made outside in the database.

Adding Mode=TwoWay cause readonly error of the QueryableEntityCollectionView data binding

<UserControl x:Class="ERP.AdminModule.Views.AdminMainView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <telerik:RadButton Content="Save" Command="{Binding Path=SubmitCommand}" CommandParameter="SubmitOrder" Margin="207,86,10,113.2"/>

        <telerik:RadGridView Name="customersGrid" GroupRenderMode="Flat"
                             Grid.Row="1"
                             Margin="0, 5, 0, 0"
                             AutoGenerateColumns="False"
                             ItemsSource="{Binding RolesView, Mode=TwoWay}"
                             IsReadOnly="False"
                             RowIndicatorVisibility="Collapsed"
                             CanUserFreezeColumns="False"
                             CanUserResizeColumns="False"
                             >
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="RoleID"
                                            DataMemberBinding="{Binding RoleID}" />
                <telerik:GridViewDataColumn Header="Name"
                                            DataMemberBinding="{Binding Name}" />
                <telerik:GridViewDataColumn Header="Prio"
                                            DataMemberBinding="{Binding Prio}" />
            </telerik:RadGridView.Columns>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="RowEditEnded" >
                    <i:InvokeCommandAction Command="{Binding Path=SubmitCommand}" CommandParameter="SubmitOrder" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </telerik:RadGridView>

    </Grid>
</UserControl>

 

using System;
using System.Collections.ObjectModel;
using System.Linq;
using Prism.Events;
using ERP.DAL;
using Prism.Mvvm;
using Telerik.Windows.Data;
using System.Windows.Input;
using Prism.Commands;
using System.Threading.Tasks;

namespace ERP.AdminModule.ViewModels
{
    class AdminMainViewModel: BindableBase
    {
        public QueryableEntityCollectionView<ACL_Roles> rolesView;
        private readonly myERPContext ctx;

        public ICommand SubmitCommand { get; private set; }

        public AdminMainViewModel(IEventAggregator eventAggregator) : base()
        {
            try
            {
                this.ctx = new myERPContext();
                this.rolesView = new QueryableEntityCollectionView<ACL_Roles>((ctx as System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext, "ACL_Roles");

                this.SubmitCommand = new DelegateCommand<object>(this.OnSubmit, this.CanSubmit);
            }
            catch
            {

            }

        }

        private void OnSubmit(object arg) { ctx.SaveChanges(); }
        private bool CanSubmit(object arg) { return true; }
        
        public QueryableEntityCollectionView<ACL_Roles> RolesView
        {
            get { return this.rolesView; }
        }
    }
}

Stefan
Telerik team
 answered on 13 Nov 2017
5 answers
123 views

We are showing a that represents a customers budget weeks which can start (WK 1) on any day in the year and are also not always 52 WKs/12 months.

It appears a provider is not the correct approach as the weeks are not bindable, hence the delay to get them from a means the data is not available when the provider is calling its format and interval requests.

Is this achievable?

Thanks,
Maurice

Dinko | Tech Support Engineer
Telerik team
 answered on 13 Nov 2017
2 answers
161 views

Hello,

Is it possible to set the document of RadPDFViewer from an XAML StackPanel?

I want to generate a PDF document from an XAML section and pass it to the PDF viewer.

Regards,

Sam.

Sam
Top achievements
Rank 1
 answered on 13 Nov 2017
1 answer
85 views

Our product use diagram to realize  a workflow, when there are too many nodes and links in the diagram, it looks very crowded ,  i wish to set some nodes and links as a group which has only one input link and only one output link, and then  i can fold the group to save space, i can also unfold the group 

Is any way to resolve this issue?

 

 

Martin Ivanov
Telerik team
 answered on 13 Nov 2017
0 answers
68 views

Hello,

I use save/load functionality of Docking. I would like to save content of each RadPane to the same file where layout stores, so I would like to get something like this:

<?xml version="1.0" encoding="utf-8"?>
<RadDocking>
    <SplitContainers>
        <RadSplitContainer Dock="DockedLeft">
            <Items>
                <RadPaneGroup SelectedIndex="0">
                    <Items>
                        <RadPane IsDockable="True" Header="Pane1" >
                            <!--My content here-->
                        </RadPane>
                    </Items>
                </RadPaneGroup>
                <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" >
                    <Items>
                        <RadPane IsDockable="True" Header="Pane1" >
                            <!--My content here-->
                        </RadPane>
                    </Items>
                </RadPaneGroup>
            </Items>
        </RadSplitContainer>
    </SplitContainers>
</RadDocking>

 

I found an old answers in the forum which say that it is not possible. Is there a chance that something changed?

If it is not possible maybe you could suggest a solution? I wanted to store the layout and content in one file.

Thank you in advance

Grigory
Top achievements
Rank 2
 asked on 11 Nov 2017
16 answers
749 views
The following ArgumentException is throwing from Telerik.Windows.Data.PropertyPathDescriptor.GetPropertyDescriptor(PropertyToken token, Type componentType) when a RadGridView binds:

throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Property with name {0} cannot be found on type {1}", new object[] { token.PropertyName, componentType.GetTypeName() }));

gives: "Property with name AfterQty cannot be found on type Object"

Sample:
<telerik2:RadGridView Width="Auto" AutoGenerateColumns="False" HorizontalAlignment="Stretch" ItemsSource="{Binding SelectionList.SelectedItem.Funds}"  >
 <telerik2:RadGridView.Columns>
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding Fund}" Header="Fund" IsReadOnly="True" />
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding BeforeQty}" Header="Before Qty" IsReadOnly="True"/>
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding CurrentQty}" Header="Order Qty" />
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding AfterQty}" Header="After Qty" />
...

SelectionList is an observable collection in another gridview, the details of which load in this one.  Funds is an observable collection on the selected item of the SelectionList.

The first time this binds there is no error.  However, on subsequent selections from the SelectionList, the ArgumentException throws. 


Edit: This happens for each column.  Version 2010.2.924.35
Douwe
Top achievements
Rank 1
 answered on 10 Nov 2017
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?