Telerik Forums
UI for WPF Forum
1 answer
244 views
I have a listbox that shows dates, when a user clicks on a specific date I want it to become editable. So when I click on the listbox item, a trigger switches its datatemplate from a template containing a textblock to a template containing a RadDatePicker.

When this occurs, the RadDatePicker immediatley updates the binding source with the value.  Why is this?  The WPF Toolkit date picker does not do this, but I'd have to use the RadDatePicker.

Because I am using entity framework self tracking entities, this immediatley marks the entity I've bound to as modified.

Does anyone know a way to stop the RadDatePicker updating the binding source as soon as it appears on a datatemplate?

I've recreated this problem in a test window.  The XAML looks like this:

<Window x:Class="RadDatePickerInTemplate.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <DataTemplate x:Key="ViewTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=Title}" />
                <TextBlock Text="{Binding Path=Date}" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="EditTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBox Text="{Binding Path=Title, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                <telerik:RadDatePicker SelectedDate="{Binding Path=Date, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
            </StackPanel>
        </DataTemplate>
        <Style x:Key="ContainerStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="ContentTemplate" Value="{StaticResource ViewTemplate}"/>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="ContentTemplate" Value="{StaticResource EditTemplate}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <ListBox x:Name="MyListBox"
                 IsSynchronizedWithCurrentItem="True" 
                 ItemContainerStyle="{StaticResource ContainerStyle}" />
    </Grid>
</Window>

... and the .cs looks like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
  
namespace RadDatePickerInTemplate
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
  
            // Show a list of Dates
            MyListBox.ItemsSource = new List<ListItem>()
            {
                new ListItem() { Title = "Test 1", Date = new DateTime(2010, 3, 27) },
                new ListItem() { Title = "Test 2", Date = new DateTime(2010, 8, 19) },
                new ListItem() { Title = "Test 3", Date = new DateTime(2010, 2, 3) }
            };
        }
    }
  
    public class ListItem
    {
        public string Title { get; set; }
  
        private DateTime _date;
        public DateTime Date
        {
            get { return _date; }
            set
            {
                // Set a breakpoint here once the form is displayed, 
                // clicking a listbox row will immediatley break here
                _date = value;
            }
        }
    }
}

Thanks for any help!
Simon.
Kaloyan
Telerik team
 answered on 25 Oct 2010
3 answers
186 views
Hi,

I am using a RadChart control with multiple RadChartAreas defined. I wanted to show individual legends belonging to each Chart area but they aren't visible. Even though I followed the examples but couldn't get the legends to display.

Here's my source code:

<telerik:RadChart x:Name="LineChartCusips" ScrollViewer.CanContentScroll="True">
                    
                    <Grid Margin="0,0,10,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="5*" />
                            <ColumnDefinition Width="2*" />                            
                        </Grid.ColumnDefinitions>
                        <telerik:ChartTitle Grid.Row="0"  
                                            Grid.ColumnSpan="2"
                                            Content="Year 2010"
                                            HorizontalAlignment="Center"                                            
                                            Style="{StaticResource CustomTitleStyle}"/>
                        
                        <telerik:ChartArea Grid.Row="1"
                                           Grid.Column="0"
                                           Grid.ColumnSpan="2"
                                           Padding="5,10,20,5"
                                           x:Name="splineChartArea"
                                           LegendName="splineLengend"                                           
                                           ItemToolTipOpening="splineChartArea_ItemToolTipOpening"/>

                        
                        <telerik:ChartTitle Grid.Row="2"
                                            Content="Monthly Distribution"
                                            Grid.ColumnSpan="2"
                                            HorizontalAlignment="Center"
                                            Style="{StaticResource CustomTitleStyle}"/>
                        
                        <telerik:ChartArea Grid.Row="3"
                                           Grid.Column="0"
                                           x:Name="barChartArea"
                                           LegendName="barLegend"
                                           ItemToolTipOpening="ChartArea2_ItemToolTipOpening"/>
                        
                        <telerik:ChartArea Grid.Row="3"
                                           Grid.Column="1"
                                           x:Name="pieChartArea"
                                           />
                      
                                                
                    </Grid>

For one of the chart areas, splineLengend, here's the code behind:
DataSeries newSeries = new DataSeries();
                newSeries.LegendLabel = tranchedata.Key.ToString();
                newSeries.Definition = new LineSeriesDefinition();
                newSeries.Definition.InteractivitySettings.HoverScope = InteractivityScope.Series;
                newSeries.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Series;                
                newSeries.Definition.ShowItemLabels = true;
                newSeries.Definition.ShowItemToolTips = true;

Thanks,
Farhan
Yavor
Telerik team
 answered on 25 Oct 2010
0 answers
110 views

Several weeks before the official release we wanted to give a preview of some of the major new controls and features coming in Q3 2010.

The new ScheduleView control for WPF 

As we announced in the beginning of this quarter we started working on a brand new scheduling component. Now that the first bits appeared you can find the new ScheduleView in the RadControls for WPF bundle. We decided to develop this new control as we wanted to prepare a really advanced Scheduling control that would fit in any application scenario. You can review the major features of the control on its product page. You can expect identical behavior, featureset and API for the ScheduleView for Silverlight that will officially come shortly after Q3 2010. 

Data Virtualization

With our 2010 Q3 Beta release we are introducing the concept of Data Virtualization - a new extension to our LINQ based data engine. The Data Virtualization technique ensures great performance and user experience improvements especially when dealing with very large datasets. The “heart” of Data Virtualization is the VirtualQueryableCollectionView class, which is responsible for loading on demand the needed chunks of data to the client. 

Data virtualization enables smooth scrolling experience in all data bound controls, which makes the components responsive all the time regardless the amount of data you present. To work properly you should use controls with UI virtualization like RadGridViewRadTreeViewRadBookRadComboBox.

Sparklines

Sparklines are used for quick graphical data visualization in the context of words, numbers or images. Their simple design and clear readability are the best way to present important business or other trends. The Sparklines are designed to be very small in size so they can perfectly fit in any text or simple grid along with other numeric data.

You can download the installation files under your accounts. The files are marked with Q3 2010 Beta.

Online demos are available at:
RadControls for WPF

We will greatly appreciate your feedback in this Beta forum.

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 25 Oct 2010
2 answers
260 views

The default scrolling behavior of a ListBox is that the scrolling goes by one item at a time. The scrolling is not smooth but as you scroll the ListBox jumps to the next item. Although if you want to you can get the ListBox to scroll smoothly by setting ScrollViewer.CanContentScroll="False".

 

The RadGridView seems to have the opposite default scrolling behavior. The RadGridView scrolls smoothly in both vertical (rows) and horizontal (columns) directions.

 

Is it possible to make the RadGridView scoll by one row or column at a time, like the ListBox does by default with its items?

 

I've tried setting ScrollViewer.CanContentScroll="True" but without luck.

haagel
Top achievements
Rank 1
 answered on 25 Oct 2010
1 answer
88 views
WPF VS2010

OK, I read through everything I could find and could not find the answer I was looking for.  How can I add an item to the list of options?  I don't want to completely create a new filter control but I want to add "Is Null", "Is Not Null" to the list of choices.  Is that possible?
Vlad
Telerik team
 answered on 25 Oct 2010
1 answer
186 views

I use a RadGridView to show data. The user is allowed to sort by any column by clicking it, using the built-in sorting feature. This works fine.

 

The problem occurs when the rows in the gridview are replaced. The gridview is always filled with rows after the user has done a search. However, the new rows are not sorted in the specified way.

 

Example:

The user does a search which fills the gridview with rows.

The user clicks the header of column A to sort by that column.

The user does a new search which fills the gridview with new  rows.

The gridview now still indicates that is is sorted by column A, but the rows are NOT sorted in that way

 

Is this a bug or "by design"? Is there any way to solve my problem?

 

If no better solution exist, I was thinking that maybe I can manually tell the gridview to sort the rows according to its current sorting state after I have filled it with new rows. But I cannot find a way to do that neither...

Vlad
Telerik team
 answered on 25 Oct 2010
5 answers
711 views
I'm binding the RadGridView to an ObservableCollection of about 1,000 items or so. I have both Row and Column Virtualization turned on. When I'm displaying my grid cells as plain TextBlocks, the realtime scrolling performance is pretty decent (Immediate scrolling is not an option). But once I start using more complex templates, like my own custom editors, scrolling performance suffers greatly, and becomes very choppy. The grid definition looks something like:

   <telerik:RadGridView
                         ItemsSource="{Binding MyItemsSource}"
                         ScrollMode="RealTime"
                         SelectionMode="Extended"
                         AutoGenerateColumns="False"
                         EnableColumnVirtualization="True"
                         EnableRowVirtualization="True">

and the columns looks like:

 <telerik:GridViewDataColumn Header="Price">

                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Price.Value}" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>

            </telerik:GridViewDataColumn>

Even if I keep the entire grid as TextBlocks but just make even a couple of columns TextBoxes, the scrolling performance starts to degrade fairly quickly. If  I disable both row and column Virtualization completely, then the grid scrolls very fast, but starts to take up a lot of memory (because it's instantiating all of the visual trees, it's something around 1GB memory usage). Are there any other settings that can help with the scrolling performance, or anything else that I can do ? I've found the grid very performant is almost all other scenarios, and it would be a shame to discard an otherwise well performing grid because of lackluster scrolling.
Milan
Telerik team
 answered on 25 Oct 2010
3 answers
641 views
In the RadComboBox I have a IsMouseOver trigger and an IsFocused trigger.  The IsMouseOver trigger changes the background color while the IsFocused trigger does not.  How can I make this work?  I've also tried doing this in the editabletemplate with no luck.

Here is test markup that demonstrates:  It should trigger a Black background on keyboard focus.

<Window 
    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" 
    x:Class="WpfApplication12.MainWindow" 
    x:Name="Window" 
    Title="MainWindow" 
    Width="327" Height="217"
 
<Window.Resources> 
 <Style  x:Key="{x:Type telerik:RadComboBox}"  TargetType="{x:Type telerik:RadComboBox}"
     <Style.Triggers> 
        <MultiTrigger> 
          <MultiTrigger.Conditions> 
             <Condition Property="IsEnabled" Value="True"/> 
             <Condition Property="IsFocused" Value="True"/> 
          </MultiTrigger.Conditions>                             
          <Setter Property="Background" Value="Black" /> 
        </MultiTrigger> 
        <MultiTrigger> 
          <MultiTrigger.Conditions> 
             <Condition Property="IsEnabled" Value="True"/> 
             <Condition Property="IsMouseOver" Value="True"/> 
          </MultiTrigger.Conditions>                             
          <Setter Property="Background" Value="Blue" /> 
        </MultiTrigger> 
     </Style.Triggers> 
 </Style> 
  
</Window.Resources> 
 
    <Grid x:Name="LayoutRoot"
        <Grid.RowDefinitions> 
         <RowDefinition Height="50" /> 
         <RowDefinition Height="50" /> 
        </Grid.RowDefinitions> 
        <TextBox >Some text</TextBox> 
        <telerik:RadComboBox  Grid.Row="1" IsEditable="True" IsReadOnly="True" Margin="0,0,0,1"
            <telerik:RadComboBoxItem Content="Item 1"/> 
            <telerik:RadComboBoxItem Content="Item 2"/> 
            <telerik:RadComboBoxItem Content="Item 3"/> 
        </telerik:RadComboBox> 
    </Grid> 
</Window> 
  
Dani
Telerik team
 answered on 25 Oct 2010
2 answers
141 views
Hello!
Since the Telerik documentation having this "How to" referring to adding a menu item to RadPane's menu is obsolete because is using the CustomMenuCommand I have a question for you.

I am adding a RadMenuItem to the template I use for all the radpanes as follows:
<DataTemplate x:Key="PaneContextMenuTemplate">
            <telerik:RadContextMenu InheritDataContext="False">
                <telerik:RadMenuItem IsChecked="{Binding IsInDocumentHost}"
                                     Command="telerikDocking:RadDockingCommands.TabbedDocument"
                                     CommandParameter="{Binding}"
                                     CommandTarget="{Binding}"
                                     Header="{Binding Command.Text,              RelativeSource={RelativeSource Self}}" />             
                <telerik:RadMenuItem IsCheckable="False"
                                     Header="Change header name"
                                     Click="RadMenuHeaderChange_Click" />
            </telerik:RadContextMenu>
        </DataTemplate>


In RadMenuHeaderChange_Click method I need to get somehow the RadPane that owns the RadContextMenu that has been opened. 
How can I achieve that?

Thank you!
Roxana

RoxanaC
Top achievements
Rank 1
 answered on 23 Oct 2010
6 answers
166 views
I have a fairly simple radgridview I'm messing around with.  the data is loaded from a dataset, I only have 1 column that is editable (all others are readonly).  However, when I edit that column it clears the cell rather than letting me edit the value it is currently.

the code:


<telerik:RadGridView HorizontalAlignment="Left" Margin="12,78,0,0" 
                             Name="gvAccounts" VerticalAlignment="Top" Height="240" Width="619" 
                             AutoGenerateColumns="False" Grid.Column="0" CanUserSortColumns="False" 
                             DataLoaded="gvAccounts_DataLoaded" LoadingRowDetails="gvAccounts_LoadingRowDetails" 
                             CanUserReorderColumns="False" ShowGroupPanel="False" EditTriggers="CellClick" 
                             BeginningEdit="gvAccounts_BeginningEdit">
            <telerik:RadGridView.Columns>
                <telerik:GridViewSelectColumn />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding acct_num}"
                                       Header="Account No" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding reg_phone_num, Mode=TwoWay}"
                                       Header="Mobile Phone No" IsReadOnly="True">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding nickname, Mode=TwoWay}"
                                       Header="Nickname">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding created_dt, Mode=TwoWay}"
                                       Header="Date Activated" IsReadOnly="True">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding address, Mode=TwoWay}"
                                       Header="Service Address" IsReadOnly="True" TextWrapping="Wrap">
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
jake
Top achievements
Rank 1
 answered on 22 Oct 2010
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
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
SplashScreen
Rating
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?