Telerik Forums
UI for WPF Forum
4 answers
256 views
Hello.
I use the <telerik:ChartPanAndZoomBehavior DragMode="Pan" PanMode="Both" ZoomMode="Both" /> for scaling the RadCartesianChart.
How I can hide the scroll bars?
Martin Ivanov
Telerik team
 answered on 27 Jan 2017
1 answer
120 views

Hi I'm using the RadCartesianChart to plot multiple series of data.

When the data range is small, I receive a divide by zero exception.

01.<telerik:RadCartesianChart Name="GraphSeriesChart" Grid.Row="2" Margin="10" Background="LightGray" >
02. 
03.        <telerik:RadCartesianChart.Behaviors >
04.            <telerik:ChartPanAndZoomBehavior ZoomMode="Both" DragMode="Pan" PanMode="Both" />
05.        </telerik:RadCartesianChart.Behaviors>
06. 
07.        <telerik:RadCartesianChart.HorizontalAxis >
08.            <telerik:DateTimeCategoricalAxis LabelFormat="HH:mm:ss" MajorTickInterval="250" LabelFitMode="MultiLine" />
09.        </telerik:RadCartesianChart.HorizontalAxis>
10. 
11.        <telerik:RadCartesianChart.VerticalAxis >
12.            <telerik:LinearAxis HorizontalLocation="Left" Visibility="Visible" />
13.        </telerik:RadCartesianChart.VerticalAxis>
14. 
15.        <telerik:RadCartesianChart.SeriesProvider >
16.            <telerik:ChartSeriesProvider Source="{Binding TECSeriesSelected}" >
17.                <telerik:ChartSeriesProvider.SeriesDescriptors >
18.                    <telerik:CategoricalSeriesDescriptor ValuePath="Value" CategoryPath="Time" >
19.                    </telerik:CategoricalSeriesDescriptor>
20.                </telerik:ChartSeriesProvider.SeriesDescriptors>
21.            </telerik:ChartSeriesProvider>
22.        </telerik:RadCartesianChart.SeriesProvider>
23. 
24.        <telerik:RadCartesianChart.Grid >
25.            <telerik:CartesianChartGrid MajorLinesVisibility="XY" >
26.                <telerik:CartesianChartGrid.MajorXLineStyle >
27.                    <Style TargetType="Line" >
28.                        <Setter Property="Stroke" Value="Gray" />
29.                    </Style>
30.                </telerik:CartesianChartGrid.MajorXLineStyle>
31.                <telerik:CartesianChartGrid.MajorYLineStyle >
32.                    <Style TargetType="Line" >
33.                        <Setter Property="Stroke" Value="Gray" />
34.                    </Style>
35.                </telerik:CartesianChartGrid.MajorYLineStyle>
36.            </telerik:CartesianChartGrid>
37.        </telerik:RadCartesianChart.Grid>
38.    </telerik:RadCartesianChart>

 

01.TECSeriesSelected.Clear();
02. 
03.TECSeriesSelected.Add(new RadObservableCollection<DataPoint>(new DataPoint[3]));
04.TECSeriesSelected.Add(new RadObservableCollection<DataPoint>(new DataPoint[3]));
05. 
06.TECSeriesSelected[0][0] = new DataPoint();
07.TECSeriesSelected[0][0].Value = 0;
08.TECSeriesSelected[0][0].Time = new DateTime(0);
09. 
10.TECSeriesSelected[0][1] = new DataPoint();
11.TECSeriesSelected[0][1].Value = 0;
12.TECSeriesSelected[0][1].Time = new DateTime(10);
13. 
14.TECSeriesSelected[0][2] = new DataPoint();
15.TECSeriesSelected[0][2].Value = 0;
16.TECSeriesSelected[0][2].Time = new DateTime(20);
17. 
18.TECSeriesSelected[1][0] = new DataPoint();
19.TECSeriesSelected[1][0].Value = 2.75E-28F;
20.TECSeriesSelected[1][0].Time = new DateTime(0);
21. 
22.TECSeriesSelected[1][1] = new DataPoint();
23.TECSeriesSelected[1][1].Value = 2.75E-28F;
24.TECSeriesSelected[1][1].Time = new DateTime(10);
25. 
26.TECSeriesSelected[1][2] = new DataPoint();
27.TECSeriesSelected[1][2].Value = 2.75E-28F;
28.TECSeriesSelected[1][2].Time = new DateTime(20);

Is there a way to fix this issue?

Tanya
Telerik team
 answered on 27 Jan 2017
11 answers
324 views
When a user wants a control added to their layout, we want it to pop up front and center.

So we do something on the order of: 

void MakeNewPane(RadPane newPane)
{
RadPaneGroup radPaneGroup = new RadPaneGroup();
RadSplitContainer splitContainer = new RadSplitContainer();
 
// Fixed 300x400 size, centered on the main window, so it's easy to find.
Window parentWindow = Window.GetWindow(this);
splitContainer.SetValue(RadDocking.FloatingSizeProperty, new Size(400, 300));
splitContainer.SetValue(RadDocking.FloatingLocationProperty, new Point((parentWindow.ActualWidth - 400) / 2, (parentWindow.ActualHeight - 300) / 2));
 
splitContainer.Items.Add(radPaneGroup);
radDocking.Items.Add(splitContainer);
 
radPaneGroup.AddItem(newPane, DockPosition.Center)
pane.MakeFloatingDockable();
}

That works well enough..  And from the user's point of view, they can drag/drop/stick the pane wherever they want..  all good so far.

When we go to save the layout though, it looks something like this:

<RadDocking>
        <SplitContainers>
          <RadSplitContainer Dock="DockedLeft" Width="414" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
            <Items>
              <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
                <Items>
                  <RadPane SerializationTag="PortfolioHierarchy1" IsDockable="True" Title="Hierarchy" Header="Hierarchy" CanDockInDocumentHost="False" />
                </Items>
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedTop" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
            <Items>
              <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
                <Items>
                  <RadPane SerializationTag="PortfolioSummary1" IsDockable="True" Title="Summary" Header="Summary" CanDockInDocumentHost="False" />
                </Items>
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedLeft" Width="240">
            <Items>
              <RadPaneGroup SelectedIndex="-1">
                <Items />
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedLeft" Width="240">
            <Items>
              <RadPaneGroup SelectedIndex="-1">
                <Items />
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedLeft" Width="240">
            <Items>
              <RadPaneGroup SelectedIndex="-1">
                <Items />
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
        </SplitContainers>
      </RadDocking>


Note the extra RadSplitContainers and RadPaneGroups that are empty..

Looking through the code, there seems to be an internal property that I can't get to ( IsAutoGenerated="True")
that would allow the RadDocking to clean things up when refreshing..  basically delete the empty ones.

How can I do that through code?  I can't figure out if there's an event I should use to clean things up or if I can somehow use AutoGenerated groups/containers myself.  

I'd much rather just say:  radDocking.AddPane(newPane, CenterParent, 300x300), and let everything else be auto from there.  

-Peter
Stefan Nenchev
Telerik team
 answered on 27 Jan 2017
1 answer
121 views

Hello,

 

I'm currently using the free trial TelerikDevCraftUltimateSetup_2016_4_1317_1 have found some strange behavior or a bug whilst trying to recreate an existing layout I want to replicate.

I have some RadPane's which needs to be docked as unpinned so they slide in and out when clicked. Inside the PadPane is a RadTabControl with 3 tabs.If I then put a PropertyGrid inside a RadTabItem the RadPane no longer stays open when a tab item is clicked. Is this a bug? Is there a way to stop this happening?

 

I've attached an example showing the problem

On the attached,

1. Click Header2 to unhide the pane (keep unpinned)

2. If you click between the 2 tabs with headers "Works Okay" you can see the expected behavior where the panel does not slide away

3. If you click on the tab with header "Not Working" and then then another tab the panel slides out of view. This tab contains a RadPropertyGrid. How can this be prevented?

 

MainWindow.xaml:

<telerik:RadWindow x:Class="WpfApp1.MainWindow"
        Header="MainWindow" Height="500" Width="800">
    <Grid>
        <telerik:RadDocking x:Name="radDocking1"
                            RetainPaneSizeMode="DockingAndFloating">
 
            <telerik:RadSplitContainer Name="LeftContainer"
                                       InitialPosition="DockedLeft">
                <telerik:RadPaneGroup x:Name="Group1">
 
                    <telerik:RadPane x:Name="mtPane" Header="Header1">
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
 
            <telerik:RadSplitContainer x:Name="RightContainer"
                                       InitialPosition="DockedRight">
                <telerik:RadPaneGroup x:Name="Group2" Margin="-310,0,6,0">
 
                    <telerik:RadPane x:Name="ssPane"
                                         Header="Header2"
                                         IsPinned="false">
                        <Grid HorizontalAlignment="Stretch"
                                  VerticalAlignment="Stretch" >
                            <Grid HorizontalAlignment="Stretch"
                                      VerticalAlignment="Top" >
 
                            </Grid>
                            <telerik:RadTabControl x:Name="radTabControl"
                                                   HorizontalAlignment="Stretch"
                                                   VerticalAlignment="Stretch">
                                <telerik:RadTabItem x:Name="RadTabSettings"
                                                    Header="Works Okay"
                                                    Height="30">
 
                                </telerik:RadTabItem>
 
                                <telerik:RadTabItem x:Name="RadTabSelections"
                                                    Header="Works Okay"
                                                    Height="30">
                                </telerik:RadTabItem>
 
                                <telerik:RadTabItem x:Name="RadTabStaking"
                                                    Header="Not Working" >
 
                                    <telerik:RadPropertyGrid x:Name="propertyGridEventStaking">
 
                                    </telerik:RadPropertyGrid>
                                </telerik:RadTabItem>
                            </telerik:RadTabControl>
                        </Grid>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
 
        </telerik:RadDocking>
    </Grid>
</telerik:RadWindow>
Stefan
Telerik team
 answered on 27 Jan 2017
1 answer
354 views

I am trying to generate a Horizontal stack bar that has approximately five different color coded "events". I would like to display a horizontal stack that shows what event was present, with respect to time. I am very new to this (sense yesterday) and am having trouble navigating to the correct approach. I would like to dynamically generate the events that are presented in the chart. Currently I have the following XAML:

 

<telerik:RadCartesianChart x:Name="radChartAction" Palette="Windows8" Margin="0,151,552.2,-0.2">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:LinearAxis/>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:CategoricalAxis/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Series>
<telerik:BarSeries CombineMode="Stack">
<telerik:BarSeries.DataPoints>
<telerik:CategoricalDataPoint Category="January" Value="5"/>
</telerik:BarSeries.DataPoints>
</telerik:BarSeries>
<telerik:BarSeries CombineMode="Stack">
<telerik:BarSeries.DataPoints>
<telerik:CategoricalDataPoint Category="January" Value="7"/>
</telerik:BarSeries.DataPoints>
</telerik:BarSeries>
<telerik:BarSeries CombineMode="Stack">
<telerik:BarSeries.DataPoints>
<telerik:CategoricalDataPoint Category="January" Value="20"/>
</telerik:BarSeries.DataPoints>
</telerik:BarSeries>
</telerik:RadCartesianChart.Series>

 

When I attempt to add an additional bar series using the following code behind it appears to have not effect. NOTE: when I Changed stacked to cluster in the code behind the graph shifts down as if to make room for the new series object. However, there is still nothing visible with regard to the programmatically generated bar series.

BarSeries ser = new BarSeries();
ser.Visibility = System.Windows.Visibility.Visible;
ser.CombineMode = Telerik.Charting.ChartSeriesCombineMode.Stack;
//ser.CombineMode = Telerik.Charting.ChartSeriesCombineMode.Cluster;
ser.ValueBinding = new PropertyNameDataPointBinding("50");
ser.CategoryBinding = new PropertyNameDataPointBinding("January");

 

 

I would like to also be able to have control over the color for the dynamically generated events. so all of event 1 is color coordinated.

Thanks

Tanya
Telerik team
 answered on 27 Jan 2017
3 answers
246 views

We are having a lot of performance issues while using RadDiagram.
We have a main window that uses Diagram as a UserControl, in the first diagram the problems start when the number of shapes is above 20 as you can see in the video i attached. However in the second diagram the performance is even worse since whith just 12 shapes the scroll movement is terrible.
I'm going to provide you as much information as i can, so we are using 2 textblocks and a textbox in our node template all of them use bindings to get the text, at first we thought about binding perfomance problems but it is still happening with regular text.
Our shapes templates dont have a large visual tree, they are just a border with a few textblocks a button and background colors.
We are using the last binary version from telerik and our class model is organized like this.
• CustomDiagram inherits from RadDiagram
• CustomShape inherits from RadDiagramShape
• CustomConnection inherits from RadDiagramConnection
However our own implementation of your controls is just a few methods or properties not a really huge overhaul.
Is there any reason why a diagram whith just 42 shapes is working that bad?
Below you can see examples of our code.
<DataTemplate x:Key="Shape1">
        <Border BorderThickness="2" Height="120" Width="200" CornerRadius="4" SnapsToDevicePixels="True">
            <Border.Effect>
                <DropShadowEffect BlurRadius="5" ShadowDepth="1" Direction="270" Color="#CCCCCC"/>
            </Border.Effect>
            <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
                    <GradientStop Color="#D31027" Offset="0" />
                    <GradientStop Color="#EA384D" Offset="0.0" />
                </LinearGradientBrush>
            </Border.Background>

            <Grid>
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="aa" FontFamily="Segoe UI Semilight" FontSize="30" Margin="4,5,6,-10" Foreground="White"></TextBlock>
                    <TextBlock Text="aa" FontFamily="Segoe UI Semilight" 

Margin="5.3,5,6,5" FontSize="15">
                        <TextBlock.Foreground>
                            <SolidColorBrush Color="White" Opacity="0.5"/>
                        </TextBlock.Foreground>
                    </TextBlock>
                </StackPanel>
                <Button x:Name="product" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Style="{DynamicResource MetroCircleButtonStyle}" Panel.ZIndex="99" Background="#333333" Foreground="White" BorderBrush="#2E2E2E" Height="45" Width="45" Margin="146,61,5,10">
                    <Button.Content>
                        <iconPacks:PackIconModern Kind="Edit" />
                    </Button.Content>
                    <Button.Effect>
                        <DropShadowEffect BlurRadius="5" ShadowDepth="1" Direction="270" Color="#CCCCCC"/>
                    </Button.Effect>
                </Button>
                <Border Background="White" CornerRadius="0,0,3,3" Margin="0,86,0,0">
                </Border>
            </Grid>
        </Border>
    </DataTemplate>
                         
        <Style TargetType="ModelShape:CustomShape">
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="BorderBrush" Value="Transparent"></Setter>
        <Setter Property="IsEditable" Value="False"></Setter>
        <Setter Property="IsResizingEnabled" Value="False"></Setter>
        <Setter Property="IsRotationEnabled" Value="False"></Setter>
        <Setter Property="ContentTemplate" Value="{DynamicResource Shape1}"></Setter>
    </Style>

We are also using your propertygrid control that loads the customshape properties everytime you click on it, we now know that everytime you click it it will update all of them on the property grid causing perfomance issues, its true that after disabling the property grid the performance is a little bit better but still not as good as expected.
this is how we iterate through every shape property and only showing the ones we want
private void CustomAutogeneratingProperty(object sender, AutoGeneratingPropertyDefinitionEventArgs e)
        {
            (e.PropertyDefinition.Binding as Binding).ValidatesOnDataErrors = true;

            (e.PropertyDefinition.Binding as Binding).NotifyOnValidationError = true;
            (e.PropertyDefinition.Binding as Binding).ValidatesOnExceptions = true;

            foreach (var prop in typeof(RadDiagramShape).
                GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance).
                Where(prop =>
                    (prop.Name.Equals(e.PropertyDefinition.AutoGeneratedPath))
                    || ((sender as CustomPropertyGrid).Item.GetType().Name.Equals(typeof(RadDiagramConnection).Name))))
            {
                e.PropertyDefinition.Visibility = Visibility.Hidden;
            }
        }
but as i said its still working awful.
We had problems using containers so we are just using shapes instead.
Our theory is that everytime you move a shape the diagram reloads all the properties, all of the bindings and maybe the ContentTemplate or maybe are issues about the draggin service not working well.
We searched for information
We are hoping you can help us in this scenario.
If you need more information just let me know.

PS: Our laptops have 16 Gb of ram and a nvidia gforce 750m there shouldnt be a problem with performance.

https://www.dropbox.com/s/irw9ie0mlfqzb6n/as.mp4?dl=0

https://www.dropbox.com/s/827orf58vxmbil2/PerformanceError.mp4?dl=0

ODB
Top achievements
Rank 1
 answered on 27 Jan 2017
1 answer
90 views

Hi there,

 

I'd like you to give some advice or demo about two questions.

When many rows are in a RadGridView,

1. the way  the RadGirdview to scroll smoothly with gradation.

2. I need to see the RadGridview row by row while scrolling.  

I'm sorry that I can't upload source code because of a security issue.

 

please reply it. thank you.

 

Martin
Telerik team
 answered on 27 Jan 2017
2 answers
235 views

Hello All,

    I am having troubles trying to get something displayed...  One would think that the issue I'm having should be pretty straight forward in implementation, but I can't seem to figure it out...  In my ViewModel, I have two observable collections: BadgeHistory collection and a CardStatus collection.  The BadgeHistory collection contains objects of an entity that has a property of a CardStatusID.  The CardStatus collection is a simple entity of an ID and Status string name.

Here is my ViewModel code:

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using MeyerToolDAL;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
 
namespace NewHireApp.ViewModel
{
    /// <summary>
    /// This class contains properties that a View can data bind to.
    /// <para>
    /// </para>
    /// </summary>
    public class EmployeeMaintenanceViewModel : TabViewModelBase
    {
        #region Fields
        private string _empID = string.Empty;
 
        private ObservableCollection<BadgeId> _badgeHistory;
        #endregion Fields
 
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the EmployeeMaintenanceViewModel class.
        /// </summary>
        public EmployeeMaintenanceViewModel()
        {
            BadgeHistory = new ObservableCollection<BadgeId>();
            using (var dc = new MeyerToolDAL.MeyerToolDALEntities())
            {
                CardStatuses = new ObservableCollection<BadgeCardStatus>(dc.BadgeCardStatus);
            }
        }
 
        /// <summary>
        /// Initializes a new instance of the EmployeeMaintenanceViewModel class.
        /// </summary>
        public EmployeeMaintenanceViewModel(string header)
        {
            Header = header;
            BadgeHistory = new ObservableCollection<BadgeId>();
            using (var dc = new MeyerToolDAL.MeyerToolDALEntities())
            {
                CardStatuses = new ObservableCollection<BadgeCardStatus>(dc.BadgeCardStatus);
            }
 
        }
        #endregion Constructors
 
        #region Properties
 
        /// <summary>
        /// Gets or sets the EmpID property.
        /// </summary>
        /// <value>
        /// Changes to that property's value raise the PropertyChanged event.
        /// </value>       
        public string EmpID
        {
            get
            {
                return _empID;
            }
 
            set
            {
                if (_empID == value)
                {
                    return;
                }
 
                _empID = value;
                RaisePropertyChanged(() => EmpID);
            }
        }
 
        /// <summary>
        /// Gets or sets the BadgeHistory property.
        /// </summary>
        /// <value>
        /// Changes to that property's value raise the PropertyChanged event.
        /// </value>       
        public ObservableCollection<BadgeId> BadgeHistory
        {
            get
            {
                return _badgeHistory;
            }
 
            set
            {
                if (_badgeHistory == value)
                {
                    return;
                }
 
                _badgeHistory = value;
                RaisePropertyChanged(() => BadgeHistory);
            }
        }
 
 
        private ObservableCollection<BadgeCardStatus> _cardStatuses;
 
        /// <summary>
        /// Gets or sets the CardStatuses property.
        /// </summary>
        /// <value>
        /// Changes to that property's value raise the PropertyChanged event.
        /// </value>       
        public  ObservableCollection<BadgeCardStatus> CardStatuses
        {
            get
            {
                return _cardStatuses;
            }
 
            set
            {
                if (_cardStatuses == value)
                {
                    return;
                }
 
                _cardStatuses = value;
                RaisePropertyChanged(() => CardStatuses);
            }
        }
        #endregion Properties
 
        #region Commands
 
        #region SearchCommand
        // move this up to the Fields region...
        private RelayCommand _searchCommand;
 
        /// <summary>
        /// Gets the SearchCommand.
        /// </summary>
        /// <value>
        /// The SearchCommand.
        /// </value>
        public RelayCommand SearchCommand
        {
            get
            {
                return _searchCommand ?? (_searchCommand = new RelayCommand(
                    SearchCommand_Execute,
                    SearchCommand_CanExecute));
            }
        }
 
        private void SearchCommand_Execute()
        {
            using (var dc = new MeyerToolDAL.MeyerToolDALEntities())
            {
                BadgeHistory = new ObservableCollection<BadgeId>(dc.BadgeIds.FindByEmployeeID(EmpID));
            }
        }
 
        private bool SearchCommand_CanExecute()
        {
            return true;
        }
        #endregion SearchCommand
        #endregion Commands
 
        #region Methods
        #endregion Methods
 
    }
}

 

Here's my View:

<UserControl
    x:Class="NewHireApp.Views.EmployeeMaintenanceView"
    xmlns:ignore="http://www.galasoft.ch/ignore"
    xmlns:local="clr-namespace:NewHireApp"
    xmlns:vm="clr-namespace:NewHireApp.ViewModel"
    mc:Ignorable="d ignore">
 
    <Grid Width="750">
 
        <Grid.RowDefinitions>
            <RowDefinition Height="35" />
            <RowDefinition Height="35" />
            <RowDefinition Height="110" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel
            Grid.Row="0"
            HorizontalAlignment="Center"
            Orientation="Horizontal">
            <telerik:RadWatermarkTextBox
                x:Name="radWatermarkTextBox"
                Width="74"
                Height="22"
                Margin="5"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Text="{Binding EmpID}"
                TextWrapping="NoWrap"
                WatermarkContent="Emp. ID" />
            <Button
                x:Name="button"
                Width="65"
                Margin="5,6,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Command="{Binding SearchCommand}"
                Content="Search" />
        </StackPanel>
        <StackPanel
            Grid.Row="2"
            HorizontalAlignment="Center"
            Orientation="Horizontal">
            <telerik:RadButton
                Margin="5"
                CornerRadius="15"
                ToolTip="Assign New Badge">
                <StackPanel Width="65">
                    <Image Height="95" Source="/Images/NewBadge.png" />
                </StackPanel>
            </telerik:RadButton>
        </StackPanel>
        <StackPanel Grid.Row="3">
            <telerik:RadGridView
                AutoGenerateColumns="False"
                ItemsSource="{Binding BadgeHistory}"
                ScrollViewer.CanContentScroll="True"
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                ShowGroupPanel="False">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn
                        DataMemberBinding="{Binding BadgeNum}"
                        Header="Badge ID"
                        IsFilterable="False" />
                    <telerik:GridViewDataColumn
                        DataFormatString="{} {0:dd MMM yyyy}"
                        DataMemberBinding="{Binding DateAdded}"
                        Header="Added On"
                        IsFilterable="False" />
                    <telerik:GridViewComboBoxColumn
                        DataMemberBinding="{Binding CardStatusId}"
                        DisplayMemberPath="CardStatus"
                        Header="Card Status"
                        IsFilterable="False"
                        SelectedValueMemberPath="CardStatusID"
                        ItemsSource="{Binding CardStatuses}" />
                    <telerik:GridViewDataColumn
                        DataMemberBinding="{Binding IssuedBy}"
                        Header="Issued By"
                        IsFilterable="False" />
                    <telerik:GridViewDataColumn
                        Width="*"
                        DataMemberBinding="{Binding Notes}"
                        Header="Notes"
                        IsFilterable="False" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </StackPanel>
    </Grid>
</UserControl>

 

In my View I have a RadGridView with the columns specified.  I have set the ItemSource of the grid to the BadgeHistory collection and for one of the columns I specified as a GridViewComboBoxColumn.   For the life of me, I can't seem to get it to display the correct stuff...  Right now as it stands, the column displays empty, but IT is a combobox, so I can select it and see all of the defined cardstatuses.  However, the initial data in the BadgeHistory collection has various values in it's CardStatusID field, and NONE of those are displaying!!!  Also when I do select a value for a particular row, it shows up, but as soon as I try and edit a different row, the previous row's value disappears!!!

Any clue as to how do I get the rows to display the CardStatus string values from the second collection???  What am I doing wrong here???  I'm pretty sure this is something simple that I'm overlooking...

 

Thanks in advance,

 

Kevin Orcutt

 

Kevin
Top achievements
Rank 1
 answered on 26 Jan 2017
0 answers
109 views
Hi, I'm coming across a weird issue. When I insert a custom merge field into my document that has regular merge fields, the font for the regular merge fields doesn't stay intact. 

For example on the template side, everything is size 9 font. When I insert the custom merge field (inserts a table), it changes the regular merge fields to size 12 when exporting to word. The custom merge field retains size 9 upon exporting to word. Any ideas how to fix this?
band
Top achievements
Rank 1
 asked on 26 Jan 2017
5 answers
559 views
Hello,

I have a grid bound to a collection of items.

An item has several properties and one property is a combination of 4 properties (omitted INotifyPropertyChanged etc):
public class MyItemViewModel
{
    public int Number { get; set; }
    public string NumberSeperator { get; set; }
    public int SubNumber { get; set; }
    public string SubSubNumber { get; set; }
     
    public string FullNumber {
        get
        {
            return string.Format("{0}{1}{2}{3}", Number, NumberSeperator, SubNumber, SubSubNumber);
        }
    }
}


There are of course more properties available but the focus is on these properties mentioned.
Now, I tried creating a custom column which will, in view mode, display the FullNumber property and in edit mode create 4 masked text boxes to edit those 4 properties seperatly (Number, NumberSeperator, SubNumber and SubSubNumber)

So I figured the cleanest & easiest way to do this was to define 5 dependency properties on the custom column, 1 for each property, so that I could bind to them in my xaml code:

<MyCustomColumn NumberBinding="{Binding Number}" NumberSeperatorBinding="{Binding NumberSeperator}" SubNumberBinding="{Binding SubNumber}" SubSubNumberBinding="{Binding SubSubNumber}" />


So my column looked a bit like this:

public class MyCustomColumn : GridViewBoundColumnBase
{
    public Binding NumberBinding
    {
        get { return (Binding)GetValue(NumberBindingProperty); }
        set { SetValue(NumberBindingProperty, value); }
    }
    public static readonly DependencyProperty NumberBindingProperty =
        DependencyProperty.Register("NumberBinding", typeof(Binding), typeof(MyCustomColumn), new PropertyMetadata(null));
         
    public Binding NumberSeperatorBinding
    {
        get { return (Binding)GetValue(NumberSeperatorBindingProperty); }
        set { SetValue(NumberSeperatorBindingProperty, value); }
    }
    public static readonly DependencyProperty NumberSeperatorBindingProperty =
        DependencyProperty.Register("NumberSeperatorBinding", typeof(Binding), typeof(MyCustomColumn), new PropertyMetadata(null));
         
    public Binding SubNumberBinding
    {
        get { return (Binding)GetValue(SubNumberBindingProperty); }
        set { SetValue(SubNumberBindingProperty, value); }
    }
    public static readonly DependencyProperty SubNumberBindingProperty =
        DependencyProperty.Register("SubNumberBinding", typeof(Binding), typeof(MyCustomColumn), new PropertyMetadata(null));
         
    public Binding SubSubNumberBinding
    {
        get { return (Binding)GetValue(SubSubNumberBindingProperty); }
        set { SetValue(SubSubNumberBindingProperty, value); }
    }
    public static readonly DependencyProperty SubSubNumberBindingProperty =
        DependencyProperty.Register("SubSubNumberBinding", typeof(Binding), typeof(MyCustomColumn), new PropertyMetadata(null));
}


So when overriding the CreateCellEditElement function, I implemented is as such:

public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
 {
    var e1 = new RadMaskedNumericInput();
    e1.SetBinding(RadMaskedNumericInput.ValueProperty, NumberBinding);
     
    var e2 = new RadMaskedTextInput();
    e2.SetBinding(RadMaskedTextInput.ValueProperty, NumberSeperatorBinding);
     
    var e3 = new RadMaskedNumericInput();
    e3.SetBinding(RadMaskedNumericInput.ValueProperty, SubNumberBinding);
     
    var e4 = new RadMaskedTextInput();
    e4.SetBinding(RadMaskedTextInput.ValueProperty, SubSubNumberBinding);
     
    var wp = new WrapPanel();
     
    wp.Children.Add(e1);
    wp.Children.Add(e2);
    wp.Children.Add(e3);
    wp.Children.Add(e4);
     
    return wp;
 }


However, when using this column it will complain that it can't find the Number, NumberSeperator, SubNumber and SubSubNumber properties on the viewmodel, which is the datacontext of the grid.

I thought it would work the same as the DataMemberBinding and automatically use as datacontext, the row item.

Any help would be appreciated :)
Sdfg
Top achievements
Rank 1
 answered on 26 Jan 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?