Telerik Forums
UI for WPF Forum
3 answers
139 views
Hi

I have a grid that starts off with no rows. The rows are created by adding to CriteriaColumnItem (see code snippet below).  When I a row the column in the new row shows the combobox column correctly.  However, when I add another row the new row shows the combobox correctly but the previous row now shows blank in the combobox column. 

Thanks
Rich


================================================================
// Used for GridViewComboBoxColumn

   public List<GroupType> TextGroupTypes = new List<GroupType>()
        {
            new GroupType {Code=4, Name="Count", },
            new GroupType {Code=1, Name="Group By", },
            new GroupType {Code=5, Name="Expression", },
            new GroupType {Code=2, Name="Min", },
            new GroupType {Code=3, Name="Max", },
            new GroupType {Code=6, Name="Where"}
        };

=============================================================================

public partial class CriteriaColumnItem
{
        public string Column { get; set; }
        public string ColumnAlias { get; set; }
        public string TableDisplayName { get; set; }
        public string SchemaName { get; set; }
        public string TableName { get; set; }
        public bool Show { get; set; }
        public string SortType{ get; set; }
        public string SortOrder { get; set; }
        public Int32 GroupByCode { get; set; }  // Used for GridViewComboBoxColumn
}

===========================================================================

<telerik:GridViewComboBoxColumn
IsFilterable="False" Width="65" Name="GroupByCode" Header="Group By"                                   
        DataMemberBinding="{Binding GroupByCode, Mode=TwoWay}"                                           
        DisplayMemberPath="Name"
        SelectedValueMemberPath="Code"  
        IsVisible="False">
</telerik:GridViewComboBoxColumn>

==============================================================================

private void radGridViewSelectedColumns_RowLoaded(object sender, RowLoadedEventArgs e)
{
CriteriaColumnItem item = e.Row.DataContext as CriteriaColumnItem;
        if (item == null)
        return;
        if(radGridViewSelectedColumns.Columns["GroupByCode"].IsVisible)
        {
        Telerik.Windows.Controls.GridViewComboBoxColumn column = 
                             radGridViewSelectedColumns.Columns["GroupByCode"] as Telerik.Windows.Controls.GridViewComboBoxColumn;
                OpenAccessHelper oaHelper = new OpenAccessHelper();
// Determine which list is needed, Only showing one for now.
                column.ItemsSource = oaHelper.TextGroupTypes;   // Is this the problem? does each row have its own itemsSource for the column
        }
}

============================================================================
Maya
Telerik team
 answered on 17 Apr 2013
11 answers
1.0K+ views
Guys,

I've the below requirement in Calender control.

  • Highlight or circle the important days with different colors (eg. public holidays in one color and local holidays in a different color)
  • Custom comments for the day should be shown in tool tip (eg. If I've applied leave for the upcoming day  it should be shown in some color (red) and if i place the mouse over it, the reason for the leave should show in tool tip)

I've attached the sample requirement with this article..

Kindly give your hands on the above requirement.

Regards, Prem


 
Vladi
Telerik team
 answered on 17 Apr 2013
2 answers
57 views
Hi everyone,

I have an issue with selection of data from the RadGridView. The issue is that suddenly, after updating my Telerik Controls for WPF to 2013.1.220.40 it started hating my selection code.

I have the following XAML:
<telerik:RadGridView
    Name="dgOrderOverview"
    AutoGenerateColumns="False"
    SelectionChanged="dgOrderOverview_SelectionChanged"
    SelectionMode="Single"
    SelectionUnit="FullRow"
    IsReadOnly="True"
    CanUserDeleteRows="False"
    CanUserInsertRows="False"
    IsBusy="False"
    telerik:StyleManager.Theme="Windows8"
    >
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=ShipmentID}" Header="ShipmentID" UniqueName="ShipmentID" IsReadOnly="True" IsVisible="False" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=OrderNo}" Header="Order no" UniqueName="OrderNo" IsReadOnly="True" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Pieces}" Header="Pieces" UniqueName="Pieces" IsReadOnly="True" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=ReceiverName}" Header="Receiver" UniqueName="ReceiverName" IsReadOnly="True" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Which then triggers the following c# code when selecting a row:
private void dgOrderOverview_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
{
        OverViewData r = (OverViewData)dgOrderOverview.SelectedItem;
        shipID = r.ShipmentID;
 
        lblSelectedReceiver.Content = r.ReceiverName;
        lblSelectedShipment.Content = shipID;
         
        if(dpStatusDate.SelectedDate == null)
            dpStatusDate.SelectedDate = DateTime.Now;
 
        tpStatusTime.Value = DateTime.Now;
        canvas1.Visibility = Visibility.Visible;
        lblCUselShipment.Content = r.ShipmentID;
}

However, when I select a row it the dgOrderOverview.SelectedItem is always null. If I look at it in the VS debugger I find that it says that SelectionEventArgs flags "remove" to the item I've selected, but the "added" is always null.

How come? This is new to me, it's been working since December before updating the RAD Controls for WPF.

//Johannes
Yoan
Telerik team
 answered on 17 Apr 2013
1 answer
104 views
I found exampale how to add toltip for each column, and it is working fine for me. I just wonder is there any way to define totlip once for whole row and bind with row data?
Maya
Telerik team
 answered on 17 Apr 2013
2 answers
217 views
Hi all,

I have an application which is using RadTreeListView to bind and display as a tree. The ItemSource is binded from ViewModel with type is RadObservableCollection and declared:

ItemsSource="{Binding HistoryList, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged,
NotifyOnSourceUpdated=True,
NotifyOnTargetUpdated=True}"

The issue is when I add a new node to HistoryList then call RaisePropertyChange of HistoryList, the UI of RadTreeListView doesn't update even though the data added.

this.HistoryList.Add(treeViewItem);
this.RaisePropertyChanged(x => x.HistoryList);

Then if I use reset() method of RadObservableCollection, the UI is updated but float top the top of view. So the question is how can I handle with it? I mean I wan to keep the state/position of node that I selected.. not jump or float.

This video gets better for you to understand: http://screencast.com/t/iLa3XWsa

Thank you
Maya
Telerik team
 answered on 17 Apr 2013
4 answers
234 views
Hello,
I referred to a MVVM RadRibbonView example and I tried to implement RadRibbonComboBox in RibbonView with MVVM method.
But it doesn't work normally.
Please see a attached screenshot image.

I make a DataTemplate as follows.

Case1 -- use RadComboBox in RibbonView

    <!-- 
    <DataTemplate x:Key="ComboBoxItemTemplate">
        <Grid>
            <TextBlock Text="{Binding Text}" />
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="ComboBoxTemplate">
        <telerik:RadComboBox 
            ItemsSource="{Binding Items}" 
            ItemTemplate="{StaticResource ComboBoxItemTemplate}"
            SelectionBoxTemplate="{StaticResource ComboBoxItemTemplate}"
            SelectedIndex="{Binding SelectedIndex}"/>
    </DataTemplate>
    -->


Case 2. use RadRibbonComboBox and RadRibbonComboBoxItem 

    <DataTemplate x:Key="ComboBoxItemTemplate">
        <telerik:RadRibbonComboBoxItem Content="{Binding Text}" />
    </DataTemplate>

    <DataTemplate x:Key="ComboBoxTemplate">
        <telerik:RadRibbonComboBox 
            ItemsSource="{Binding Items}" 
            ItemTemplate="{StaticResource ComboBoxItemTemplate}"
            SelectedIndex="{Binding SelectedIndex}"/>
    </DataTemplate>
Hyunho
Top achievements
Rank 1
 answered on 16 Apr 2013
3 answers
316 views
There appears to be a memory leak when a DocumentRuler is associated to a RadRichTextBox.  The following is code for a demo WPF Application project that can demonstrate this issue:

MainWindow.Xaml:
<Window x:Class="RulerMemoryLeakDemo.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>       
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button Click="ButtonBase_OnClick">New Editor</Button>
        </StackPanel>
        <StackPanel Grid.Row="1" Name="editHost"></StackPanel>
    </Grid>
</Window>

MainWindow.xaml.cs:
using System.ComponentModel;
using System.Windows;
 
namespace RulerMemoryLeakDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public class EditorViewModel : INotifyPropertyChanged
        {
            private string _rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 RTF File - Hello World\par
}";
            public string Rtf
            {
                get { return _rtf; }
                set
                {
                    _rtf = value;
                    OnPropertyChanged("Rtf");
                }
            }
 
            public event PropertyChangedEventHandler PropertyChanged;
 
            protected virtual void OnPropertyChanged(string propertyName)
            {
                var handler = PropertyChanged;
                if (handler != null)
                    handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
 
        public MainWindow()
        {
            InitializeComponent();
        }
 
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            editHost.Children.Clear();
            var viewModel = new EditorViewModel();
            var view = new EditorView {DataContext = viewModel};
            editHost.Children.Add(view);           
        }
    }
}

EditorView.xaml:
<UserControl
    x:Class="RulerMemoryLeakDemo.EditorView"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="1000"
    FontFamily="Arial" FontSize="11">   
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>   
        <telerik:DocumentRuler Grid.Row="0" AssociatedRichTextBox="{Binding ElementName=editor, Mode=OneTime}"/>
        <telerik:RadRichTextBox x:Name="editor"     
                                Margin="24 24 0 0"
                                Grid.Row="0"
                                LayoutMode="Flow"/>
        <telerik:RtfDataProvider x:Name="rtfProvider"                                 
                                 RichTextBox="{Binding ElementName=editor}"
                                 Rtf="{Binding Path=Rtf, Mode=TwoWay}"  />
    </Grid>
</UserControl>

EditorView.xaml.cs:
using System.Windows.Controls;
namespace RulerMemoryLeakDemo
{
    public partial class EditorView : UserControl
    {
        public EditorView()
        {
            InitializeComponent();         
        }
    }
}


The demo app has a button "New Editor" which will create a new usercontrol with a RadRichTextBox and associated DocumentRuler and add it to the main window.  If you keep pressing the New Editor button you will see that the memory usage of the application keeps growing.  Repeatedly creating new editors on my desktop caused the application memory usage to grow to over 4GB.

However, in EditorView.xaml, if you comment out the DocumentRuler declaration and repeat the test you will find that the memory usage of the application no longer grows unbound.  On my desktop the memory usage of the application after commenting out this line stayed under 400MB.

My desktop is running Win 7 x64, though this problem was observed on a number of different systems.
Boby
Telerik team
 answered on 16 Apr 2013
1 answer
172 views
HI,

 I was wondering if it was possible to use a combination of properties in GroupDescriptor.

For example:

I have the data set: 
new DummyModel { Name = "Bob", Test = "A", Part = "i", Score = 12},
new DummyModel { Name = "Bob", Test = "A", Part = "ii", Score = 11},
new DummyModel { Name = "Bob", Test = "B", Part = "i", Score = 15},
new DummyModel { Name = "Bob", Test = "B", Part = "ii", Score = 16},
new DummyModel { Name = "Sue", Test = "A", Part = "i", Score = 6},
new DummyModel { Name = "Sue", Test = "A", Part = "ii", Score = 14},
new DummyModel { Name = "Sue", Test = "B", Part = "i", Score = 22},
new DummyModel { Name = "Sue", Test = "B", Part = "ii", Score = 18},

I would like to group by Name and Test and show the sum of the two parts (ordered by Name, then Test).

I recently had this working by adding a property to DummyModel that had both a Name and Test Properties and implemented IComparable and overwrote Equals and GetHashCode which allowed the grouping and sorting as I desired.I used this property as the Member property of the GroupDescriptor.

However this stopped working when we upgraded to v4.0.30319.

Any help on this issue would be greatly appreciated.

Thanks,

Steven
Steven
Top achievements
Rank 1
 answered on 16 Apr 2013
3 answers
157 views
Hello,

I'm using a custom DragVisualProvider with the ListBoxDragDropBehavior and I can't seem to figure out how to offset the mouse position within the dragVisual. I know you can get the RelativeStartPoint from DragVisualProviderState, but how do you set that on the newly created dragVisual (ContentControl, in this case). 

Here is my custom DragVisualProvider code:

public FrameworkElement CreateDragVisual(DragVisualProviderState state)
{
     
    var visual = new ContentControl();
     
    var theme = StyleManager.GetTheme(state.Host);
    if (theme != null)
    {
        StyleManager.SetTheme(visual, theme);
    }
 
    var draggedItem = state.DraggedItemContainers.First() as FrameworkElement;
    visual.Height = draggedItem.ActualHeight;
    visual.Width = draggedItem.ActualWidth;
     
    visual.Content = state.DraggedItems.OfType<object>().FirstOrDefault();
    visual.ContentTemplate = this.DragVisualTemplate;
     
    return visual;
}

Thanks in advance
Vladi
Telerik team
 answered on 16 Apr 2013
3 answers
548 views
Hey there. I have a project with a RadMenu and it's menu Items are defined like so:


        <Style x:Key="MenuItemBaseStyle" TargetType="telerik:RadMenuItem">
            <Setter Property="Header" Value="{Binding Content}" />
            <Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
            <Setter Property="ItemsSource" Value="{Binding}" />
        </Style>

        <Style x:Key="MenuItemLinkStyle" TargetType="telerik:RadMenuItem" BasedOn="{StaticResource MenuItemBaseStyle}">
            <Setter Property="Template" Value="{StaticResource MenuItemLinkControlTemplate}" />
            <Setter Property="Margin" Value="4 3 4 2" />
        </Style>

And the Template is defined:

        <ControlTemplate x:Key="MenuItemLinkControlTemplate" TargetType="telerik:RadMenuItem">
            <StackPanel>
                <Button Click="ButtonBase_OnClick" Content="{Binding Content}" Style="{StaticResource LinkButtonMenu}" />
            </StackPanel>
        </ControlTemplate>


I know it looks weird that It's a button, but there's a very specific reason we're doing that due to some issues we had after the last release. It was working fine prior to having to change it and I need it to work with the current Template I have defined for it. I tried setting the StaysOpenOnClick  property to false in the style as well and the issue still persisted. Thanks in advanced for the help.
Rosen Vladimirov
Telerik team
 answered on 16 Apr 2013
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
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
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?