Telerik Forums
UI for WPF Forum
2 answers
301 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
642 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
1 answer
107 views

Is there any way of replicating the look of a Step Line series (as in the RadChartView) in a Sparkline? I.e, instead of drawing lines straight between points, it treats points as "rising edges?"

 

Thanks

Martin Ivanov
Telerik team
 answered on 10 Nov 2017
1 answer
867 views

I used MVVM to create a data source(property), then I use RadCartesianChart to plot it. It works but I can not see the tooltip when hover mouse to the bars.

<telerik:ChartDataSource x:Name="ChartDataSource1" Items="{Binding Sales}" />
 
<telerik:RadCartesianChart x:Name="barSeries">
   <telerik:RadCartesianChart.Behaviors>
      <telerik:ChartTooltipBehavior="Top" VerticalOffset="20" />
   </telerik:RadCartesianChart.Behaviors>
   <telerik:RadCartesianChart.TooltipTemplate>
        <DataTemplate>
           <Grid>
            <Path Data="M-1236,-441 L-1180,-441 -1180,-424 -1228,-424 -1230.5,-420 -1233,-424 -1236,-424 z"
                      Stretch="Fill" Fill="Beige" Stroke="Gray" StrokeThickness="2"/>
                <StackPanel Margin="5,5,5,18">
                    <StackPanel Orientation="Horizontal">
                        
                        <TextBlock Text="{Binding Path=DataItem.Quarter}" FontWeight="Bold" FontSize="11"/>
                       </StackPanel>
           </Grid>
        </DataTemplate>
        <telerik:RadCartesianChart.Grid>
             <telerik:CartesianChartGrid MajorLinesVisibility="XY"
                                         MajorYLineDashArray="10,5"
                                         MajorXLinesRenderMode="All"
            </telerik:CartesianChartGrid>
        </telerik:RadCartesianChart.Grid>  
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis/>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis/>
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:BarSeries CategoryBinding="Quarter" ValueBinding="Profit" Items="{Binding Element=ChartDataSource1}"/>
</telerik:RadCartesianChart>

Thanks

 

Dinko | Tech Support Engineer
Telerik team
 answered on 10 Nov 2017
4 answers
526 views

I followed this Binding the Color Series-Items

However I can't get the different colors for the bars by using telerik:RadCartesianChart. Please advise me.

<telerik:BarSeries CategoryBinding="Category" ValueBinding="Value" ItemsSource="{Binding}">
        <telerik:BarSeries.PointTemplate>
            <DataTemplate>
                <Rectangle Fill="{Binding DataItem.Color}"/>
            </DataTemplate>
        </telerik:BarSeries.PointTemplate>
    </telerik:BarSeries>
Martin Ivanov
Telerik team
 answered on 10 Nov 2017
2 answers
95 views

Hi!

I'm adding panes dynamically to a RadSplitPanel inside DocumentHost. I would like to layout them (after added) in dock like style (non tab) how can I achieve that in code or XAML ?

 

Thanks,

 

Vladimir

Stefan
Telerik team
 answered on 09 Nov 2017
2 answers
109 views

I am building an application that will have an unknown number of tabs. Inside each tab is a chart with two data sets. I can get the dynamically created tabs working. I can also get the chart working outside of the tab control, but when I combine them, the chart area just says No Data points. It should be noted that I am following the MVVM pattern, so there is no code behind for the view. Everything is done with databinding in the xaml. The data to which I am binding is an observable collection with an observable collection inside it. Here is the view xaml.

<Grid>
        <TabControl ItemsSource="{Binding TotalGradeProfile}">
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
            </TabControl.ItemTemplate>
 
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <telerik:RadCartesianChart x:Name="chart"
                                               Palette="Summer">
 
                        <telerik:RadCartesianChart.HorizontalAxis>
                            <telerik:LinearAxis/>
                        </telerik:RadCartesianChart.HorizontalAxis>
 
                        <telerik:RadCartesianChart.VerticalAxis>
                            <telerik:LinearAxis HorizontalAlignment="Right"></telerik:LinearAxis>
                        </telerik:RadCartesianChart.VerticalAxis>
 
                        <telerik:RadCartesianChart.SeriesProvider>
                            <telerik:ChartSeriesProvider Source="{Binding GradeProfiles}">
                                <telerik:ChartSeriesProvider.SeriesDescriptors>
                                    <telerik:ScatterSeriesDescriptor XValuePath="Mp"
                                                                     YValuePath="RegionGrade">
                                        <telerik:ScatterSeriesDescriptor.Style>
                                            <Style TargetType="telerik:ScatterLineSeries">
                                                <Setter Property="StrokeThickness" Value="2"/>
                                            </Style>
 
                                        </telerik:ScatterSeriesDescriptor.Style>
                                    </telerik:ScatterSeriesDescriptor>
                                </telerik:ChartSeriesProvider.SeriesDescriptors>
                            </telerik:ChartSeriesProvider>
                        </telerik:RadCartesianChart.SeriesProvider>
                    </telerik:RadCartesianChart>
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
    </Grid>

 

Rob
Top achievements
Rank 1
 answered on 09 Nov 2017
2 answers
374 views

Hello,
I am struggling with listboxes, with something looks quite simple :
<telerik:RadListBox  SelectionMode="Single" x:Name="radListBox" ItemsSource="{Binding Tasks}" SelectedItem="{Binding SelectedPlcTemplate.Task, Mode=TwoWay}" DisplayMemberPath="Name"  />

In my ViewModel:

 public ObservableCollection<PlcTask> Tasks
        {
            get { return PlcTask.GetAll(); }
        }

In my model:

 private PlcTask _task;
        public PlcTask Task
        {
            get
            {
                return _task;
            }
            set
            {
                _task = value;
                RaisePropertyChanged(() => Task);
            }
        }

 

The listbox never updates its value, even if the model is correctlyt updated

florian
Top achievements
Rank 1
 answered on 09 Nov 2017
1 answer
229 views
Hi -
I am trying to implement treeview that will have multiple expandable 1st level nodes. When one of the 1st level nodes is expanded, subitems of that node (they should not be expandable) should be displayed as a grid. I tried with setting Wrap panel for ItemsPanel, but in that case virtualization stops working.
<Style TargetType="telerik:RadTreeViewItem" x:Key="RadTreeViewItemStyle">
           <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
           <Setter Property="HorizontalContentAlignment" Value="Left"/>
           <Setter Property="VerticalContentAlignment" Value="Center"/>
           <Setter Property="BorderThickness" Value="1"/>
           <Setter Property="Padding" Value="1 4 5 4"/>
           <Setter Property="MinHeight" Value="24"/>
           <Setter Property="IsDropAllowed" Value="True"/>
           <Setter Property="IsEnabled" Value="True"/>
           <Setter Property="IsTabStop" Value="False"/>
           <Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
           <Setter Property="Template" Value="{StaticResource TreeViewItemDefaultTemplate}"/>
           <Setter Property="ItemsPanel">
               <Setter.Value>
                   <ItemsPanelTemplate>
                           <WrapPanel Orientation="Horizontal" VerticalAlignment="Bottom"/>
                   </ItemsPanelTemplate>
               </Setter.Value>
           </Setter>
       </Style>
When I set telerik:TreeViewPanel for ItemPanel, virtualization is working, but subitems of nodes are shown in a vertical list?

Is there any way to achieve that behavior, so subitems are shown in wrap panel, but to keep virtualization working?

Thanks in advance! 
Dinko | Tech Support Engineer
Telerik team
 answered on 09 Nov 2017
4 answers
355 views
Hello,

I was looking for a way to disable the formula capabilities of the control is this possible?(e.g =SUM(A+B)).
This without the need to disable the cells.

Kind regards,

Thomas,
Marcus
Top achievements
Rank 1
 answered on 09 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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?