Telerik Forums
UI for WPF Forum
1 answer
310 views
I'm trying to have Validation errors for my RadMaskedTextBox, Currently I was able to do that but it's dynamic and I want to change that.If I set the range only < 250, and I put 500 inside the textbox it'll trigger and the Validation Error will appear.What I want to happen is the Validation Error only happen when my button is pressed. May I ask how do I convert to do that?
Xaml

<ControlTemplate x:Key="validationTemplate">
    <DockPanel>
        <AdornedElementPlaceholder />
        <TextBlock FontSize="20" Foreground="Red">Error!</TextBlock>
    </DockPanel>
</ControlTemplate>

<controls:RadMaskedCurrencyInput
    x:Name="radMaskedCurrencyInput"
    InputBehavior="Insert"
    Validation.ErrorTemplate="{StaticResource validationTemplate }"
    Value="{Binding Path=DecimalValue,
    ValidatesOnDataErrors=True,
    ValidatesOnExceptions=True,
    NotifyOnValidationError=false,
    UpdateSourceTrigger=PropertyChanged}" />

<Button Content="Execute" cal:Message.Attach="[Click] = [ExecuteMessage]"/>ViewModel:private decimal decimalValue;

public decimal DecimalValue
{
    get { return decimalValue; } 
    set
    {
    if (value > 250)
    {
        throw new ValidationException("Value cannot be greater than 250.");
    }
    else
    decimalValue = value;
    this.OnPropertyChanged("DecimalValue");
    }
}
Pavel R. Pavlov
Telerik team
 answered on 25 Sep 2014
4 answers
401 views
I have a WPF MVVM application with a screen that has a Telerik Chart(RadCartesianChart) on it. The chart can contain more than one series in it. I need to have at least one of the series be clickable and based on the click execute a command in the View Model sending it the point (or at least the X axis) on the line that was clicked.

I believe I need to set the Command and CommandParameter in the codebehind of the page, but not sure how.

In the end I need the click command of the series to execute the PlotChartItemClickedCommand Sending it a parameter containing the X axis data which in my case is the Category.

Below is my code XAML, CodeBehind and VM. Any help would be greatly appreciated

XAML:
<telerik:RadCartesianChart x:Name="RccLineChart"
                              Width="354"
                              Height="300" >
    <telerik:RadCartesianChart.Resources>
        <DataTemplate x:Key="PointTemplate">
            <Ellipse Height="6" Width="6" Fill="red" />
        </DataTemplate>
    </telerik:RadCartesianChart.Resources>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis ShowLabels="False" Title="Count" x:Name="LineHorzAxis"/>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis Maximum="{Binding Path=MaxYValue}" Minimum="{Binding Path=MinYValue}" Title="C"/>
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.Series>
    </telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>

CodeBehind:
public CodeBehindConstructor()
{
    InitializeComponent();
    InitialIzeLineChart();
}
 
private void InitialIzeLineChart()
{
    foreach (CartesianSeries series in GetSeries())
    {
        RccLineChart.Series.Add(series);
    }
}
 
private IEnumerable<CartesianSeries> GetSeries()
{
    string Line1ItemsSourcePath = string.Empty;
    string PointsItemsSourcePath = string.Empty;
    string referenceLineItemsSourcePath = string.Empty;
    string Line1Resource = string.Empty;
    string PointsResource = string.Empty;
    Line1Resource = "Line1Template";
    PointsResource = "PointTemplate";
 
    CategoricalSeries Line1Series = null;
    CategoricalSeries PointSeries = null;
    CategoricalSeries referenceLineSeries = null;
    Line1Series = new LineSeries();
    PointSeries = new PointSeries();
    referenceLineSeries = new LineSeries();
 
    Line1ItemsSourcePath = "Line1Data";
    PointsItemsSourcePath = "PointsData";
    referenceLineItemsSourcePath = "ReferenceLine";
 
    List<CartesianSeries> generatedSeries = new List<CartesianSeries>();
    Line1Series.CategoryBinding = new PropertyNameDataPointBinding("Category");//this is what we want to send to the VM on the click of the chart
    Line1Series.ValueBinding = new PropertyNameDataPointBinding("Data");
    Line1Series.ShowLabels = false;
    Line1Series.CombineMode = ChartSeriesCombineMode.None;
    Line1Series.IsHitTestVisible = true;
    Line1Series.SetBinding(CategoricalSeries.ItemsSourceProperty, new Binding(Line1ItemsSourcePath));
    Line1Series.PointTemplate = this.Resources[Line1Resource] as DataTemplate;
 
    //CommandBinding lineCB = new CommandBinding();
    //ICommand lineCommand = new ICommand();
     
    generatedSeries.Add(Line1Series);
 
    PointSeries.CategoryBinding = new PropertyNameDataPointBinding("Category");
    PointSeries.ValueBinding = new PropertyNameDataPointBinding("Data");
    PointSeries.ShowLabels = true;
    PointSeries.CombineMode = ChartSeriesCombineMode.None;
    PointSeries.SetBinding(CategoricalSeries.ItemsSourceProperty, new Binding(PointsItemsSourcePath));
    PointSeries.PointTemplate = this.Resources[PointsResource] as DataTemplate;
 
    generatedSeries.Add(PointSeries);
 
    referenceLineSeries.CategoryBinding = new PropertyNameDataPointBinding("Category");
    referenceLineSeries.ValueBinding = new PropertyNameDataPointBinding("Data");
    referenceLineSeries.ShowLabels = false;
    referenceLineSeries.CombineMode = ChartSeriesCombineMode.None;
    referenceLineSeries.IsHitTestVisible = true;
    referenceLineSeries.SetBinding(CategoricalSeries.ItemsSourceProperty, new Binding(referenceLineItemsSourcePath));
    referenceLineSeries.PointTemplate = this.Resources[Line1Resource] as DataTemplate;
 
    generatedSeries.Add(referenceLineSeries);
 
    return generatedSeries;
}

ViewModel:
public RelayCommand<ChartItemClickEventArgs> PlotChartItemClickedCommand
{
    get { return new RelayCommand<ChartItemClickEventArgs>(PlotChartItemClickedExecute, AlwaysTrueCanExecute); }
}
 
private void ProfilePlotChartItemClickedExecute(object e)
{
    int xPointClicked = ?????
 
}



Petar Marchev
Telerik team
 answered on 25 Sep 2014
12 answers
110 views
Hello,

I installed the Q2 SP1 and now the RadComboBox shows different than before.
How can I reuse the Windows8 Theme?
Masha
Telerik team
 answered on 25 Sep 2014
3 answers
433 views
Hi I'm trying to display a System.Windows.Controls.WebBrowser in a RadWindow. The WebBrowser does not appear to render properly. The WebBrowser control is there (I can right click and display the context menu) but the page it displays is not visible? The following code snippets should demonstrate the issue...
Create the RadWindow in response to a button click...
<Window x:Class="TelerikForm.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
    <Button Name="launchWindow" Content="launchNewWindow" Click="launchWindow_Click" /> 
  </Grid> 
</Window> 
private void launchWindow_Click(object sender, RoutedEventArgs e) { 
  RadWindow testWindow = new RadWindow(); 
  testWindow.Content = new Browser(); 
  testWindow.Show(); 
And add some content containing the WebBrowser...
<UserControl x:Class="TelerikForm.Browser" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="600" Height="600"
    <StackPanel> 
    <Border Width="590" Height="590" Margin="5" BorderBrush="Black" BorderThickness="1"
      <WebBrowser Name="browser" Loaded="browser_Loaded" > 
      </WebBrowser>       
    </Border> 
    </StackPanel> 
</UserControl> 
private void browser_Loaded(object sender, System.Windows.RoutedEventArgs e) {       
      browser.Navigate(new Uri("http://www.google.co.uk/", UriKind.RelativeOrAbsolute), nullnull""); 
Thanks in advance..Simon...
Datafyer
Top achievements
Rank 1
 answered on 25 Sep 2014
7 answers
121 views
I noticed a great deal of files being supported. Is there a way to import outlook emails? Either directly from pst or some intermediate method?
Petya
Telerik team
 answered on 24 Sep 2014
5 answers
160 views
I've extended the demo such that the minimap displays about two hours of time, and the main scheduleview displays about 10 minutes.

What I'd like is for movement of the timebar on the minimap to change the horizontal scrolling of the timeline in the scheduleview. And vice versa.

From what I can tell, the original code timebar simple adjusted "VisibleDays" in the scheduleview. Since I am always much less than a day this is no longer a good way to synchronize views.

Is there a way to bind the timebar slider value to the horizontal slider value on the scheduleview? I've attached a screenshot.
Yana
Telerik team
 answered on 24 Sep 2014
2 answers
76 views
Hello all of you, I am new to programming, I have a problem with my website, I want to redirect my website from virtuoso.co.in to http://www.virtuoso.co.in (non www to www).. I am using .htaccess file for redirection as I have read somewhere, but it is not working. I think maybe my .htaccess code is wrong or maybe server problem.

my .htaccess code is:

Options +FollowSymLinks
RewriteEngine on
# index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Please help me out.. thanks in advance!

Maria
_______________
Virtuoso IT Solutions Pvt. Ltd.





Maria
Top achievements
Rank 1
 answered on 24 Sep 2014
1 answer
129 views
Hi,

I created a custom UserControl based on the RadAutoCompleteBox control and I customized the dropdown using a style to have a grouping feature. In the dropdown, for each group, I use a RadExpander containing the group title and a button to expand or collapse the group. If the user use the up/down arrow keys to navigate through the item, when the user are on an expander, I would like to catch to catch the left/right arrow keys to expand/collapse the expander.

How it's possible to do this???

Thank's
Alain

Here is my style:

            <Style x:Key="SearchBoxControlItem" TargetType="telerik:RadListBoxItem" BasedOn="{StaticResource RadListBoxItemStyle}">
                <Setter Property="FontWeight" Value="Medium" />
                <Setter Property="FontFamily" Value="Segoe UI" />
                <Setter Property="FontSize" Value="12" />
                <Setter Property="IsEnabled" Value="True"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <WrapPanel Grid.Column="0" VerticalAlignment="Center" Orientation="Horizontal" Margin="5 0">
                                    <TextBlock Text="{Binding Name}" Foreground="Black" FontWeight="Normal" IsHitTestVisible="False" TextWrapping="Wrap" VerticalAlignment="Center"/>
                                    <TextBlock Text="{Binding TotalItems, StringFormat='({0})'}" Foreground="Black" FontWeight="Normal" IsHitTestVisible="False" Margin="5 0 0 0" VerticalAlignment="Center"/>                                    
                                </WrapPanel>
                                <Rectangle Grid.Column="1" Fill="LightGray" Height="1" Stroke="LightGray" VerticalAlignment="Center" Margin="2 0" />
                                <telerik:RadExpander Style="{DynamicResource RadExpanderStyle}" Grid.Column="2" Margin="2 0" Loaded="RadExpander_Loaded" Collapsed="RadExpander_CollapsedExpanded" VerticalAlignment="Center" Expanded="RadExpander_CollapsedExpanded" IsTabStop="False" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
Vladi
Telerik team
 answered on 24 Sep 2014
0 answers
243 views
When validation is active in radgrid cell, cannot lost focus from cell.
Standart red border in cell apear from IDataErrorInfo when triger validation according inner business logic.
But why cannot change cursor from current edit cell with error? Cannot change cursor focus to other cell.

Why?

<telerik:RadGridView x:Name="NASA_PriorityShips" ItemsSource="{Binding ShipCollections, Mode=TwoWay}"
                      SelectionMode="Single" SelectedItem="{Binding Path=SelectedShip, Mode=TwoWay}" 
                      AutoGenerateColumns="False" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
                      ColumnWidth="*" CanUserFreezeColumns="False">

                     
workaround: Must press key "Esc" to undo changes in cell, validation will be set to none active.

I set ActionOnLostFocus="None" but the same as first one.

<telerik:RadGridView x:Name="NASA_PriorityShips" ActionOnLostFocus="None" ItemsSource="{Binding ShipCollections, Mode=TwoWay}"
                      SelectionMode="Single" SelectedItem="{Binding Path=SelectedShip, Mode=TwoWay}" 
                      AutoGenerateColumns="False" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
                      ColumnWidth="*" CanUserFreezeColumns="False">
                     
                     
ActionOnLostFocus="None" in RadGridView not work at all.
kity
Top achievements
Rank 2
 asked on 24 Sep 2014
3 answers
171 views
Hi,

I'm trying this code, but it doesnt draw a grid:

ChartMain = new RadCartesianChart();

Style style = new Style();
style.TargetType = typeof(Line);
style.Setters.Add(new Setter(Line.StrokeProperty, Brushes.Black));
style.Setters.Add(new Setter(Line.StrokeThicknessProperty, new Thickness(2.0)));

CartesianChartGrid chartGrid = new CartesianChartGrid();
chartGrid.MajorLinesVisibility = GridLineVisibility.XY;
chartGrid.MajorYLineStyle = style;
chartGrid.MajorXLineStyle = style;

ChartMain.Grid = chartGrid;
Martin Ivanov
Telerik team
 answered on 24 Sep 2014
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?