Telerik Forums
UI for WPF Forum
1 answer
177 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
152 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
191 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
106 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
94 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
814 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
1 answer
171 views

In my application I am using the RadRichTextBox to allow users to add formatted "Notes".

Once created, these "Notes" are displayed in a Listbox, as read-only notes.

Since there can be dozens of "Notes" on a page, I am concerned that using the RadRichTextBox in the ListBox, is a bit "heavy" performance wise.

Is there a more efficient way of displaying these?

Tanya
Telerik team
 answered on 10 Nov 2017
1 answer
296 views

I have several curves on a single plot which are populated with a SeriesProvider like as follows:

<telerik:RadCartesianChart.SeriesProvider>
    <telerik:ChartSeriesProvider Source="{Binding DataToPlot.OperationConditions}">
         <telerik:ChartSeriesProvider.SeriesDescriptors>
            <telerik:CategoricalSeriesDescriptor ItemsSourcePath="DataPoints" ValuePath="Magnitude" CategoryPath="TimeLabel">
                <telerik:CategoricalSeriesDescriptor.Style>
                    <Style TargetType="telerik:LineSeries" BasedOn="{StaticResource LineSeriesStyle}">
                                                <Setter Property="LegendSettings">
                                                    <Setter.Value>
                                                        <telerik:SeriesLegendSettings Title="{Binding Name}"/>
                                                    </Setter.Value>
                        </Setter>
                    </Style>
                </telerik:CategoricalSeriesDescriptor.Style>
            </telerik:CategoricalSeriesDescriptor>
        </telerik:ChartSeriesProvider.SeriesDescriptors>
    </telerik:ChartSeriesProvider>
</telerik:RadCartesianChart.SeriesProvider>

 

In addition, I have another set of data which I should populate on the same plot with the same X-axis values (date/time). However these data have another order of magnitude (another physical meaning), so the only way is to add additional Y-axis on the same plot. I have the following xaml-code:

<telerik:LineSeries ItemsSource="{Binding Path=DataToPlot.VibrationConditions}"
                                            CategoryBinding="TimeLabel"
                                            ValueBinding="Magnitude">
                            <telerik:LineSeries.VerticalAxis>
                                <telerik:LinearAxis HorizontalLocation="Left" ElementBrush="Green"/>
                            </telerik:LineSeries.VerticalAxis>
 </telerik:LineSeries>

 

When these blocks of code are located one after other, the former (data which are populated with a SeriesProvider) is depicted on a plot as I expected, but the latter (data which are populated with LineSeries) is depicted as a vertical green line to the left of the first Y-Axis (see attachment).

Is is possible to combine multiply Y-data (from various sources and distinct populating mechanism) on a single plot?

 

Martin Ivanov
Telerik team
 answered on 10 Nov 2017
2 answers
323 views

Hi Telerik,

 

I want to create a GridViewComboBoxColumn with checkbox items. I found some topics but all not corresponded with my case.

 

My Xaml code : 

<telerik:RadGridView x:Name="RadGridViewCommunicationToUsers" CanUserInsertRows="True" CanUserFreezeColumns="False" Grid.Row="1" CanUserDeleteRows="False" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="True" CanUserSelect="True" CanUserSortColumns="True" SelectionMode="Single" SelectionUnit="FullRow"
 AutoGenerateColumns="False" IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False"
 ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" NewRowPosition="Top"                                          ItemsSource="{Binding CustomMessagesScheduled, UpdateSourceTrigger=PropertyChanged}"                                           CellValidating="RadGridViewCommunicationToUsers_CellValidating" RowEditEnded="RadGridViewCommunicationToUsers_RowEditEnded"                                          AddingNewDataItem="RadGridViewCommunicationToUsers_AddingNewDataItem" RowValidating="RadGridViewCommunicationToUsers_RowValidating">                       
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewComboBoxColumn UniqueName="Diffusion" Header="Diffusion" TextAlignment="Center" Width="100"  SelectedValueMemberPath="ID_Plant" EditTriggers="CellClick" IsComboBoxEditable="False"                                                             DisplayMemberPath="Text" ItemsSource="{Binding PlantsForUser}">
                                <telerik:GridViewComboBoxColumn.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="{Binding Text}" IsChecked="{Binding IsSelected}" />
                                    </DataTemplate>
                                </telerik:GridViewComboBoxColumn.ItemTemplate>
                            </telerik:GridViewComboBoxColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>

 

My VB classes (ItemsSource for the combo and ItemsSource for the GridView) :

Public Class CustomPlant
 
#Region "Properties"
 
    Private _id As Long
    Public Property ID_Plant() As Long
        Get
            Return Me._id
        End Get
        Set(value As Long)
            Me._id = value
        End Set
    End Property
 
    Private _text As String
    Public Property Text() As String
        Get
            Return _text
        End Get
        Set(ByVal value As String)
            _text = value
        End Set
    End Property
 
    Private _isSelected As Boolean
    Public Property IsSelected() As Boolean
        Get
            Return Me._isSelected
        End Get
        Set(value As Boolean)
            Me._isSelected = value
        End Set
    End Property
 
 
#End Region
 
    Public Sub New(ByVal p_plantFrom As Plant)
        Me.ID_Plant = p_plantFrom.ID
        Me.Text = String.Format("{0} - {1}", p_plantFrom.Code, p_plantFrom.Name)
        Me.IsSelected = True ' p_isSelected
    End Sub
 
End Class
 
Public Class CustomMessage
 
    Private _message As MessageSchedule
    Public Property Message As MessageSchedule
        Get
            Return _message
        End Get
        Set(value As MessageSchedule)
            _message = value
        End Set
    End Property
 
    Private _customPlantsDiffusion As ObservableCollection(Of CustomPlant)
    Public Property CustomPlantsDiffusion As ObservableCollection(Of CustomPlant)
        Get
            Return _customPlantsDiffusion
        End Get
        Set(value As ObservableCollection(Of CustomPlant))
            _customPlantsDiffusion = value
        End Set
    End Property
 
    'Private _selectedPlants As String
    'Public ReadOnly Property SelectedPlantsAsText As String
    '    Get
    '        _selectedPlants = String.Empty
 
    '        For Each p As CustomPlant In Me.CustomPlantsDiffusion
    '            If p.IsSelected Then
    '                _selectedPlants += String.Format("{0};", p.Text)
    '            End If
    '        Next
 
    '        If _selectedPlants.Length > 2 Then
    '            _selectedPlants = _selectedPlants.Substring(0, (_selectedPlants.Length - 2)) 'Remove the last ';'
    '        End If
 
    '        Return _selectedPlants
    '    End Get
    '    'Set(value As String)
    '    '    _selectedPlants = value
    '    'End Set
    'End Property
 
    Public Sub New(ByVal p_messageFrom As MessageSchedule, ByVal p_attachedPlants As ObservableCollection(Of CustomPlant))
        Me.Message = p_messageFrom
        Me.CustomPlantsDiffusion = p_attachedPlants
    End Sub
End Class

 

The ItemsSource in my ViewModel :

Private _customMessagesScheduled As New ObservableCollection(Of CustomMessage)
    Public Property CustomMessagesScheduled() As ObservableCollection(Of CustomMessage)
        Get
            Return _customMessagesScheduled
        End Get
        Set(ByVal value As ObservableCollection(Of CustomMessage))
            _customMessagesScheduled = value
            OnPropertyChanged("CustomMessagesScheduled")
        End Set
    End Property

 

The problems are :

- I want to add a "Select all" item to select or unselect all items, but I don't know how I can do it.

- I'm not sure that the binding is correct

- I want to display the selected items in the grid view cell corresponding, e.g. : Plant_1;Plant2;Plant3 if I have 3 plants selected. If all items are selected, it will be displayed "All". I can't do it with my SelectedPlantsAsText

- After I have added this colum, the "Row to add new item" doesn't works... And I don't know why.

- The good boxes should be selected depanding on CustomPlantsDiffusion by CustomMessage.

 

I hope you can help me, it's urgent !

 

Thank you very much.

 

 

Valentin
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 10 Nov 2017
9 answers
681 views

I am ad my charts and several Series in code behind:

RadCartesianChart chart = new RadCartesianChart();
            chart.Margin = new Thickness(0, 78, 0, -13);
            chart.HorizontalAxis = new CategoricalAxis();
            chart.VerticalAxis = new LinearAxis();
            chart.HorizontalAxis.Visibility = System.Windows.Visibility.Collapsed;
            chart.VerticalAxis.Visibility = System.Windows.Visibility.Collapsed;
LineSeries line = new LineSeries();
LineSeries line2 = new LineSeries();
line.Stroke = new SolidColorBrush(Colors.Blue);
line2.Stroke = new SolidColorBrush(Colors.Red);
chart.Series.Add(line);
chart.Series.Add(line2);
his.LayoutRoot.Children.Add(chart);

And i want to add Legend for each Series in code behind.

Martin Ivanov
Telerik team
 answered on 10 Nov 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?