Telerik Forums
UI for WPF Forum
4 answers
219 views

Hi,
When I’m using font size smaller that 12 in the radRichText box - the caret is disappears.

When I’m enlarging the font size to 12 or more - the caret appeared again.

Do you know what’s causing this and how can I fix this?

Thanks

Rotem
Top achievements
Rank 1
 answered on 06 Sep 2011
6 answers
211 views

Hi, I’m using custom column that contains telerik rich text box.
My problem is that when I mark some text in the rich text box and clicking on one of the formatting options in the formatting popup dialog the focus of the richtext box is lost and the formatting is not applied on the selected text.

Here is my code

public class RichTextColumn : Telerik.Windows.Controls.GridViewBoundColumnBase  //GridViewColumn

{

  public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)

  {

     var richTextBox = cell.Content as RadRichTextBox;

     if (richTextBox == null)

     {

          richTextBox = new RadRichTextBox();

          richTextBox.IsReadOnly = true;

          richTextBox.SetBinding(RadRichTextBehaviours.RTFDocumentProperty, DataMemberBinding);

          richTextBox.IsHitTestVisible = false;

          richTextBox.AcceptsTab = false;

          richTextBox.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

          richTextBox.IsSpellCheckingEnabled = false;

          richTextBox.VerticalAlignment = VerticalAlignment.Top;

          richTextBox.BorderThickness = new Thickness(0);

          RadRichTextBehaviours.SetCancelSelectionOnLostFocus(richTextBox, true);

          cell.Content = richTextBox;

     }

     else

     {

          richTextBox.IsReadOnly = true;

     }

     return richTextBox;

  }

  public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)

  {

     var richTextBox = new RadRichTextBox();

     richTextBox.SetBinding(RadRichTextBehaviours.RTFDocumentProperty, DataMemberBinding);

     richTextBox.AcceptsTab = false;

     richTextBox.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

     richTextBox.IsSpellCheckingEnabled = false;

     richTextBox.VerticalAlignment = VerticalAlignment.Top;

     richTextBox.BorderThickness = new Thickness(0);

     RadRichTextBehaviours.SetCancelSelectionOnLostFocus(richTextBox, true);

     return richTextBox;

  }

}

Can you please help?
Thanks, Rotem.

Vanya Pavlova
Telerik team
 answered on 06 Sep 2011
2 answers
332 views
Hi there,

is it possible to disable Row details unload while the user scrolls through the grid ?
With one row being expanded and showing row details, all works fine, except when the user scrolls down and up again.
I'd like to save the time to handle unload/load code, because inside RadGridView we have a tab control with several tabs.

Best regards
Oliver
Oliver Abraham
Top achievements
Rank 2
 answered on 06 Sep 2011
1 answer
113 views
Hi,

I would like to extend ChartLegendItem to handle series visibility management (by some additional control). As thisclass is not sealed, is it possible to inherit by it and apply custom ControlTemplate?

Thanks & Regards
G.
Ves
Telerik team
 answered on 05 Sep 2011
1 answer
73 views

I have a question on chart zooming.  When I zoom,  radchart creates blank whitespace before the series. The size of the space varies with the range of my zoom.  I have attached a picture to show what I mean. 

Can I force the chart to paint across the whole plot area and not leave 20% of my chart space blank?

Thanks,
Dave

http://i54.tinypic.com/2dvu0lz.png
Ves
Telerik team
 answered on 05 Sep 2011
1 answer
119 views
Picture the scenario like this: A playlist with songs that GridWiew shows and when I outside the application update the "playlist" I need GridView to smoothly show the updated data.  Data contains "songname", "playdate", "sortOrder"

Showing and edit the playlist is easy, but how do I do the "live" update best?  It could contains many rows like 20000;

var query = from o in contex.playlists
                        where o.date >= _today
                        orderby o.playdate, o.sortOrder
                        select o;
 
            _playlists = new ObservableCollection<playlist>(query.ToList());
 
            radGridView1.ItemsSource = _playlists;

Any ideas?

/Ken
Maya
Telerik team
 answered on 05 Sep 2011
3 answers
136 views
Hello!

I was using a very old telerik library from 2009. Now I have upgraded (or I am trying) to use the newest telerik library.

Since I have upgraded to the latest internal build, I am having issues with the insert key on an empty GridView.
Everything works fine, but if I remove all items from the grid, I can not create a new one with the insert key.

It seems that its not a general GridView issue, because I have created a test application, where it works without any problems.
Probably its a combination with some containers which causes this odd behavior. I have tried to rebuild my container structure in my test application, but could not reproduce the problem.

I have tried to catch the insert key in the keydown event, but the key down event is not fired when the grid is empty.

Now comes the real odd behavior:
If there is a scrollbar in the GridView and I click an arrow in the scrollbar or click in the scrollbar (so that the bar jumps to that position), the insert key works! However, it does not work if I sort columns, move columns, click anywhere in or on the GirdView or even just drag the scrollbar.

Any ideas?

Many thanks,
Franziska
Franziska
Top achievements
Rank 1
 answered on 05 Sep 2011
1 answer
187 views
I am using one TreeListView in my WPF application. One of my column is binded with decimal values. So when I edit a cell and enter any invalid value like a string then the cell is getting Red border automatically and does not allow me to lost focus. I want some more validations that should be done on a cell like the following

• Value can have up to one decimal (example: 10.1)
• Allow only numeric values (0 - 9)
• Value entered cannot be > 1000

If the above condition fails then the red border should come. By default the second constion is working fine. Please help me how I will be able to work out the first and last conition.
Maya
Telerik team
 answered on 05 Sep 2011
3 answers
569 views
Hello,
 I am working on wpf application with MVVM pattern. I have telerik grid containg categories of business objects ( categoryid, category number, category name). I allow user to inline gridview editing. I have managed to update, delete categories as i expected. When user add new category, user will enter category name and will save the record to database. Gridview selected item is binding with CurrentCateogry property in viewmodel and every time selection changes it will update the currenty category in the viewmodel. After user updated the record, corresponding category will save to database and generate new categoryid and category number and passes to the UI. Above all, corresponding selected item will not updating with new values though it has updated the current category property in viewmodel.

I have attached code samples as follows.

Category.cs
==========

using

 

 

System;

 

using

 

 

System.Collections.Generic;

 

using

 

 

System.Linq;

 

using

 

 

System.Text;

 

using

 

 

System.Data;

 

using

 

 

System.IO;

 

using

 

 

System.ComponentModel;

 

using

 

 

System.Data.SqlClient;

 

namespace

 

 

RadGridSelectedItemBindingTwoWay

 

{

 

 

 

public class Category : INotifyPropertyChanged

 

{

 

 

 

 

 

 

private Int32 _CategoryId;

 

 

 

private string _CategoryNumber;

 

 

 

private string _CategoryName;

 

 

 

 

 

 

public Category()

 

{

 

 

this.CategoryId = -1;

 

 

 

this.CategoryNumber = String.Empty;

 

 

 

this.CategoryName = String.Empty;

 

}

 

 

 


public
Category(Int32 CategoryId, string CategoryNumber, string CategoryName)

 

{

 

 

this.CategoryId = CategoryId;

 

 

 

this.CategoryNumber = CategoryNumber;

 

 

 

this.CategoryName = CategoryName;

 

 

}

 

 


public
Int32 CategoryId

 

{

 

 

get

 

{

 

 

return _CategoryId;

 

}

 

 

set

 

{

_CategoryId =

 

value;

 

OnPropertyChanged(

 

"CategoryId");

 

}

}

 

 

public string CategoryNumber

 

{

 

 

get

 

{

 

 

return _CategoryNumber;

 

}

 

 

set

 

{

_CategoryNumber =

 

value;

 

OnPropertyChanged(

 

"CategoryNumber");

 

}

}

 

 


public
string CategoryName

 

{

 

 

get

 

{

 

 

return _CategoryName;

 

}

 

 

set

 

{

_CategoryName =

 

value;

 

OnPropertyChanged(

 

"CategoryName");

 

}

}

 

 

 


public
override string ToString()

 

{

 

 

string CategoryString = String.Empty;

 

CategoryString =

 

this.CategoryName;

 

 

 

 

return CategoryString;

 

}

 

 


public
event PropertyChangedEventHandler PropertyChanged;

 

 

 

private void OnPropertyChanged(string propertyName)

 

{

 

 

if (this.PropertyChanged != null)

 

{

 

 

this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

 

}

}

 

}

}


MainWindow.xaml
=============

<

 

 

Window x:Class="RadGridSelectedItemBindingTwoWay.MainWindow"

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

 

xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

 

 

 

xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"

 

 

 

xmlns:nav="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"

 

 

 

xmlns:RadBind="clr-namespace:RadGridSelectedItemBindingTwoWay"

 

 

 

Title="RadGridView - Selected Item Binding Two Way - MVVM" Height="350" Width="525">

 

 

 

 

<Grid>

 

 

 

 

<StackPanel Grid.Row="0" Grid.Column="0" Margin="10,10" >

 

 

 

 

<nav:RadTabControl>

 

 

 

 

<nav:RadTabItem Header="Category">

 

 

 

 

<Grid>

 

 

 

 

<Grid.RowDefinitions>

 

 

 

 

<RowDefinition Height="50*"/>

 

 

 

 

<RowDefinition Height="*"/>

 

 

 

 

<RowDefinition Height="40*"/>

 

 

 

 

</Grid.RowDefinitions>

 

 

 

 

<telerik:RadDataPager Grid.Row="0" PageSize="20" Source="{Binding Items, ElementName=CategoryRadGridView}"

 

 

 

IsTotalItemCountFixed="False" DisplayMode="FirstLastPreviousNextNumeric, Text"

 

 

 

/>

 

 

 

 

<telerikGrid:RadGridView Grid.Row="1" x:Name="CategoryRadGridView" GridLinesVisibility="Horizontal"

 

 

 

AutoGenerateColumns="False" SelectionMode="Single"

 

 

 

RowIndicatorVisibility="Hidden" IsReadOnly="False"

 

 

 

CanUserFreezeColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Hidden"

 

 

 

ShowGroupPanel="False"

 

 

 

ItemsSource="{Binding Categories}"

 

 

 

ActionOnLostFocus="None"

 

 

 

SelectedItem="{Binding Path=CurrentCategory, UpdateSourceTrigger=Explicit,Mode=TwoWay}"

 

 

 

 

KeyboardNavigation.AcceptsReturn="True"

 

 

 

>

 

 

 

 

<telerikGrid:RadGridView.Columns>

 

 

 

 

<telerikGrid:GridViewDataColumn DataMemberBinding="{Binding CategoryId, Mode=TwoWay}" Header="Category Id" IsReadOnly="True" IsVisible="True" />

 

 

 

 

<telerikGrid:GridViewDataColumn DataMemberBinding="{Binding CategoryNumber, Mode=TwoWay}" Header="Category Number" Width="300*" IsReadOnly="True"/>

 

 

 

 

<telerikGrid:GridViewDataColumn DataMemberBinding="{Binding CategoryName, Mode=TwoWay}" Header="Category Name" IsVisible="True" />

 

 

 

 

 

<telerikGrid:GridViewDataColumn >

 

 

 

 

<telerikGrid:GridViewColumn.CellTemplate>

 

 

 

 

<DataTemplate>

 

 

 

 

<telerik:RadButton x:Name="Category_SaveRow" HorizontalAlignment="Stretch"

 

 

 

ToolTip="Update" Content="Update"

 

 

 

Command="{Binding Path=CategorySaveCommand}"

 

 

 

Loaded="Category_SaveRow_Loaded"

 

 

 

Click="Category_SaveRow_Click">

 

 

 

 

</telerik:RadButton>

 

 

 

 

</DataTemplate>

 

 

 

 

</telerikGrid:GridViewColumn.CellTemplate>

 

 

 

 

</telerikGrid:GridViewDataColumn>

 

 

 

 

 

<telerikGrid:GridViewDataColumn >

 

 

 

 

<telerikGrid:GridViewColumn.CellTemplate>

 

 

 

 

<DataTemplate>

 

 

 

 

<telerik:RadButton x:Name="Category_RemoveRow" HorizontalAlignment="Stretch"

 

 

 

ToolTip="Delete" Content="Delete"

 

 

 

Command="{Binding Path=CategoryDeleteCommand}"

 

 

 

Loaded="Category_RemoveRow_Loaded"

 

 

 

Click="Category_RemoveRow_Click"

 

 

 

>

 

 

 

 

</telerik:RadButton>

 

 

 

 

</DataTemplate>

 

 

 

 

</telerikGrid:GridViewColumn.CellTemplate>

 

 

 

 

</telerikGrid:GridViewDataColumn>

 

 

 

 

</telerikGrid:RadGridView.Columns>

 

 

 

 

</telerikGrid:RadGridView>

 

 

 

 

<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="5">

 

 

 

 

<telerik:RadButton Grid.Row="2" Content="Add Category" Width="100" Margin="5,5"

 

 

 

Command="telerikGrid:RadGridViewCommands.BeginInsert" CommandTarget="{Binding ElementName=CategoryRadGridView}"/>

 

 

 

 

<telerik:RadButton Grid.Row="2" Content="Cancel" Width="100" Margin="5,5"

 

 

 

Command="telerikGrid:RadGridViewCommands.CancelRowEdit" CommandTarget="{Binding ElementName=CategoryRadGridView}"/>

 

 

 

 

</StackPanel>

 

 

 

 

</Grid>

 

 

 

 

 

</nav:RadTabItem>

 

 

 

 

 

</nav:RadTabControl>

 

 

 

 

</StackPanel>

 

 

 

 

</Grid>

 

</

 

 

Window>

 


MainWindowCS
-------------------

using

 

 

System.Windows;

 

using

 

 

System.Windows.Controls;

 

using

 

 

Telerik.Windows.Controls;

 

namespace

 

 

RadGridSelectedItemBindingTwoWay

 

{

 

 


public
partial class MainWindow : Window

 

{

 

 

MyViewModel _MyViewModel;

 

 

 

public MainWindow()

 

{

InitializeComponent();

_MyViewModel =

 

new MyViewModel();

 

 

 

this.DataContext = _MyViewModel;

 

}

 

 

private void Category_SaveRow_Loaded(object sender, RoutedEventArgs e)

 

{

 

 

var button = (Button)sender;

 

button.Command = _MyViewModel.CategorySaveCommand;

}

 

 

private void Category_SaveRow_Click(object sender, RoutedEventArgs e)

 

{

 

 

// TODO : Explicitly set current category of the view model

 

_MyViewModel.CurrentCategory = (

 

Category)((RadButton)sender).DataContext;

 

 

 

this.CategoryRadGridView.CommitEdit();

 

}

 

 


private
void Category_RemoveRow_Loaded(object sender, RoutedEventArgs e)

 

{

 

 

var button = (Button)sender;

 

button.Command = _MyViewModel.CategoryDeleteCommand;

}

 

 

private void Category_RemoveRow_Click(object sender, RoutedEventArgs e)

 

{

 


 

_MyViewModel.CurrentCategory = (

 

Category)((RadButton)sender).DataContext;

 

}

}

}


MyViewModel :
------------------

using

 

 

System;

 

using

 

 

System.Collections.ObjectModel;

 

using

 

 

System.ComponentModel;

 

using

 

 

System.Windows.Input;

 

using

 

 

RadGridSelectedItemBindingTwoWay.Model;

 

 

namespace

 

 

RadGridSelectedItemBindingTwoWay

 

{

 

 

public class MyViewModel : INotifyPropertyChanged

 

{

 

 

private ObservableCollection<Category> _Categories; // trigger category updates

 

 

 

private DelegateCommand _CategorySaveCommand; // Handle category save as delegate command

 

 

 

private DelegateCommand _CategoryDeleteCommand;// Handle cateogry delete as delegate command

 

 

 

 

private Category _CurrentCategory;

 

 

 

 

public MyViewModel()

 

{

 

 

this.Categories = GetComponentCategories();

 

 

 

// Initialize the delegate commands

 

_CategorySaveCommand =

 

new DelegateCommand(CategorySave);

 

_CategoryDeleteCommand =

 

new DelegateCommand(CategoryDelete);

 

}

 

 

 

 

 

public ObservableCollection<Category> Categories

 

{

 

 

get

 

{

 

 

return _Categories;

 

}

 

 

set

 

{

_Categories =

 

value;

 

 

 

this.OnPropertyChanged("Categories");

 

}

}

 

 

public ICommand CategorySaveCommand

 

{

 

 

get

 

{

 

 

if (_CategorySaveCommand == null)

 

{

_CategorySaveCommand =

 

new DelegateCommand(CategorySave);

 

}

 

 

return this._CategorySaveCommand;

 

}

}

 

 

public ICommand CategoryDeleteCommand

 

{

 

 

get

 

{

 

 

if (_CategoryDeleteCommand == null)

 

{

_CategoryDeleteCommand =

 

new DelegateCommand(CategoryDelete);

 

}

 

 

return this._CategoryDeleteCommand;

 

}

}

 

 

public Category CurrentCategory

 

{

 

 

get

 

{

 

 

return this._CurrentCategory;

 

}

 

 

set

 

{

 

 

this._CurrentCategory = value;

 

 

 

this.OnPropertyChanged("CurrentCategory");

 

}

}

 

 

 

 

private ObservableCollection<Category> GetComponentCategories()

 

{

 

 

ObservableCollection<Category> categoryOC = new ObservableCollection<Category>();

 

categoryOC.Add(

 

new Category(1, "000001", "Category1"));

 

categoryOC.Add(

 

new Category(2, "000002", "Category2"));

 

categoryOC.Add(

 

new Category(3, "000003", "Category3"));

 

 

 

 

return categoryOC;

 

}

 

 

 

 

public void CategorySave()

 

{

 

 

// Save to database and generate category id and category number and will return to the UI layer

 

 

 

Category SavedCategory = SaveCategoryToDatabaseAndReturnSavedCategory(this.CurrentCategory);

 

 

 

this.CurrentCategory = SavedCategory; // I am expecting to see save category id and catgory number as selected

 

 

 

// item is binding with current category property but not updated the UI with new values

 

 

}

 

 

private void CategoryDelete()

 

{

 

 

this.Categories.Remove(this.CurrentCategory);

 

}

 

 

private Category SaveCategoryToDatabaseAndReturnSavedCategory(Category toSaveCategory)

 

{

 

 

// Temp method to category to database and generate sequential new category id and category number

 

 

 

Category newCategory = new Category();

 

 

 

Random random = new Random();

 

newCategory.CategoryId = random.Next(100);

newCategory.CategoryNumber = newCategory.CategoryId.ToString();

newCategory.CategoryName = toSaveCategory.CategoryName;

 

 

return newCategory;

 

}

#region

 

 

INotifyPropertyChanged Members

 

 

 

 

public event PropertyChangedEventHandler PropertyChanged;

 

 

 

//protected virtual void OnPropertyChanged(string propertyName)

 

 

 

//{

 

 

 

// if (null != this.PropertyChanged)

 

 

 

// {

 

 

 

// this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

 

 

 

// }

 

 

 

//}

 

 

 

//protected virtual void NotifyPropertyChanged(string propertyname)

 

 

 

//{

 

 

 

// if (PropertyChanged != null)

 

 

 

// {

 

 

 

// PropertyChanged(this, new PropertyChangedEventArgs(propertyname));

 

 

 

// }

 

 

 

//}

 

 

 

protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)

 

{

 

 

PropertyChangedEventHandler handler = this.PropertyChanged;

 

 

 

if (handler != null)

 

{

handler(

 

this, args);

 

}

}

 

 

private void OnPropertyChanged(string propertyName)

 

{

 

 

this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));

 

}

#endregion

}

}


Command
-------------

public

 

 

class DelegateCommand : ICommand

 

{

 

 

private Action _executeMethod;

 

 

 

public DelegateCommand(Action executeMethod)

 

{

_executeMethod = executeMethod;

}

 

 

public bool CanExecute(object parameter)

 

{

 

 

return true;

 

}

 

 

public event EventHandler CanExecuteChanged;

 

 

 

public void Execute(object parameter)

 

{

_executeMethod.Invoke();

}

}


Thanking You..
Maya
Telerik team
 answered on 03 Sep 2011
1 answer
81 views
I have spent the last few days getting the GridView "ready" for data entry (Insert, Update, Delete) and I did notice some issues, like the need to hit Escape twice while "adding a new record" (ShowInsertRow) as well some errors when I try to add a new record after doing a "cancel new record"

Then I come across the link below and that just tells me that I want to go away from having these operations (Insert, Update, Delete) in the GridView

http://www.telerik.com/community/forums/silverlight/gridview/addingnewdataitem-and-haschanges.aspx

Now, what I would like to do is open up a window an style it appropriately for Data Entry. I am sure this has been asked/covered already but I was not able to find much. Can someone please point me in the right direction?

Thanks in advance.
Vanya Pavlova
Telerik team
 answered on 03 Sep 2011
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
VirtualKeyboard
HighlightTextBlock
Security
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?