Telerik Forums
UI for WPF Forum
2 answers
124 views
Hello,

I have a radchart and personalized chartlegend. In my chartlegend I have a checkbox and I need to get the color that has given radchart sets. But when I try to know the color, in "aparrence" fields appear all to null, but really if you are painting with a certain color.

<telerik:RadChart x:Name="RadChart1"
                  Grid.Row="1"
                  Grid.Column="1"
                  UseDefaultLayout="False">
    <telerik:RadChart.SamplingSettings>
        <telerik:SamplingSettings SamplingFunction="Average" />
    </telerik:RadChart.SamplingSettings>
 
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="10" />
            <RowDefinition Height="*" />
            <RowDefinition Height="100" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>
        <Grid />
        <telerik:ChartLegend x:Name="legendChart"
                             Grid.Row="2"
                             Grid.Column="1"
                             Header=""
                             ItemContainerStyle="{DynamicResource CharLegendStyle}"
                             ItemsPanelOrientation="Horizontal"
                             LegendItemMarkerShape="Circle"
                             UseAutoGeneratedItems="false" />
 
        <telerik:ChartArea x:Name="lineGraphChartArea"
                           Grid.Row="1"
                           Grid.Column="1"
                           HorizontalAlignment="Stretch"
                           VerticalAlignment="Stretch"
                           EnableAnimations="False"
                           LegendName="legendChart">
            <telerik:ChartArea.AxisX>
                <telerik:AxisX Title="Fecha"
                               AutoRange="True"
                               IsDateTime="True"
                               Step="1" />
            </telerik:ChartArea.AxisX>
            <telerik:ChartArea.AxisY>
                <telerik:AxisY Title="CMN"
                               AutoRange="True"
                               ExtendDirection="Up"
                               IsZeroBased="True" />
            </telerik:ChartArea.AxisY>
 
 
        </telerik:ChartArea>
 
    </Grid>
 
 
</telerik:RadChart>


public SeriesMapping GenerateRandomSeries(string nameSerie,int begin)
        {
            SeriesMapping serie1 = new SeriesMapping();
            serie1.ItemsSource = GenerateRandomData(begin);
            serie1.ChartAreaName = "lineGraphChartArea";
            serie1.LegendLabel = nameSerie;
            ItemMapping X = new ItemMapping("Fecha", DataPointMember.XValue);
            ItemMapping Y = new ItemMapping("CMN", DataPointMember.YValue);
            serie1.ItemMappings.Add(X);
            serie1.ItemMappings.Add(Y);
 
            serie1.SeriesDefinition = new SplineSeriesDefinition()
                {
                    
                };
            
             
 
            return serie1;
 
        }
 
public void AddSerieDefinition()
        {
 
 
            RadChart1.SeriesMappings.Add(GenerateRandomSeries("serie1",5));
            RadChart1.SeriesMappings.Add(GenerateRandomSeries("serie2",10));
            RadChart1.SeriesMappings.Add(GenerateRandomSeries("serie3",15));
        }


I try get color and (look attached)


Thank you!
david
Top achievements
Rank 1
 answered on 03 Sep 2013
1 answer
175 views
I am trying to bind a contextual group to the IsActive property using a custom property of a UserControl. The contextual tab should only be shown after the user has selected a port from a dropdown list. I have tried each of the following with no success, but hopefully it gives you an idea of what I'm trying to do.

<telerik:RadRibbonView.ContextualGroups>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding RelativeSource={RelativeSource Self}, Path=IsPortSelected}"/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding ElementName=_this, Path=IsPortSelected}"/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MyRibbon}}, Path=IsPortSelected}"/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=IsPortSelected}"/>
</telerik:RadRibbonView.ContextualGroups>

Where IsPortSelected is the property in MyRibbon:

string _port = "";
public string Port
{
    get { return _port; }
    set
    {
        if (_port == value)
        {
            return;
        }
        _port = value;
    }
}
 
public bool IsPortSelected
{
    get
    {
        if (String.IsNullOrEmpty(_port))
        {
            return false;
        } else if (_port.Equals("Port")) {
            return false;
        }
        return true;
    }
    set { }
}

Is there something wrong with my binding statement? Or do I need to do something else in the code behind, such as implementing a PropertyChangedEventHandler (which I have tried with no success as well)?
Pavel R. Pavlov
Telerik team
 answered on 03 Sep 2013
1 answer
86 views
Hello,

I got a RadGridView Inside a RadWindow, I'm trying to paste in this RadGridview some data copied from Excel, it works fine if i click over the left top corner of the Radgridview, but if i open the RadWindow and attempt to paste right away, it just doesnt work, the paste event doesnt get fired. the globlal functionality is:


1. Press some button and open the RadWindow with my empty RadGridView Inside
2. Without clicking anywhere,  Press Ctrl + V and paste inside the RadGridView all the data that i have in the clipboard
3. that's it

I tried to set the focus to the RadGridView, but it doesnt seems to work.

Thanks.

Maya
Telerik team
 answered on 03 Sep 2013
4 answers
360 views
Hi,

any easy way to replace the selected text with new style ?
Sopan
Top achievements
Rank 1
 answered on 03 Sep 2013
5 answers
382 views
hi,
Can we have grid lines that is shown on the graph as dotted lines instead of dashed lines?
<telerik:RadCartesianChart.Grid>
                    <telerik:CartesianChartGrid>
                        <telerik:CartesianChartGrid.Style>
                            <Style TargetType="telerik:CartesianChartGrid">
                                <Setter Property="MajorXLineDashArray" Value="10,5"/>
                                <Setter Property="MajorYLineDashArray" Value="10,5"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=DisplayGridLines}" Value="1">
                                        <Setter Property="MajorLinesVisibility" Value="X"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding Path=DisplayGridLines}" Value="2">
                                        <Setter Property="MajorLinesVisibility" Value="Y"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding Path=DisplayGridLines}" Value="3">
                                        <Setter Property="MajorLinesVisibility" Value="XY"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </telerik:CartesianChartGrid.Style>

                        <telerik:CartesianChartGrid.MajorXLineStyle>
                            <Style TargetType="Line">
                                <Setter Property="Stroke" Value="Gray"/>
                            </Style>
                        </telerik:CartesianChartGrid.MajorXLineStyle>

                        <telerik:CartesianChartGrid.MajorYLineStyle>
                            <Style TargetType="Line">
                                <Setter Property="Stroke" Value="Gray"/>
                            </Style>
                        </telerik:CartesianChartGrid.MajorYLineStyle>
                    </telerik:CartesianChartGrid>
                </telerik:RadCartesianChart.Grid>

I have 10 points being shown on the graph. so the grid lines appear for all the 10 points. Can we have it just five and increase it if needed?
Please reply as soon as possible.

Petar Marchev
Telerik team
 answered on 02 Sep 2013
1 answer
106 views

When a property return type is ArraySegment<T> and properties are auto-generated, an exception is thrown and the control is not displayed.

My example specifically:

public class TestClass
{
    private readonly ArraySegment<string> _strings;
    public IReadOnlyList<string> Strings
    {
        get { return this._strings; }
    }
}
Maya
Telerik team
 answered on 02 Sep 2013
0 answers
94 views
Hi is there any possibility to pin RadPane from code behind? for example I have button inside radpane and after pressing the button I want to pin my RadPane

I am sorry for post I have my answer it is isPinned = false; (I had true value so It doesnt worked :D) please delete this topic :) thank you :)
Jiri
Top achievements
Rank 1
 asked on 02 Sep 2013
3 answers
199 views
In our project we want to load settings. Because of the origin of this settings structure these are very generic, exposed via wcf etc. So when we load them in our viewmodel they have the type Object. Also they consist of the real type information so we can convert them to the corresponding type. So far so good. 

When we load them in a gridview we would like to have different controls, for the different types. A Boolean should be a togglebutton, a int a numeric updown control and a string a regular textbox. For this approach we use Template selectors, but we also need to convert the types of the objects as described above. Therefore we use converters so the controls accepting the correct values and types. Until this point everything works great. We the problem arises when you scroll down in the grid. I guess you did some optimization. Therefore the templates and converters are evaluated when scrolling down. But in a different order then on initial loading. When the grid load for the first time, first the template is selected and then the converter. But when scrolling down, this order changes. To me that's a bit strange, because how can the converter be determined is there is no template. You will find sample code below. Only in our application there are binding errors showing up in the output window, in this example not. But the problem is still the same. Can we work around this issue, or need you guys to update this?

MainWindow:
<Grid>
        <Grid.Resources>
            <local:BooleanConverter x:Key="BooleanConverter" />
            <local:InvBooleanConverter x:Key="InvBooleanConverter" />
            <local:StringToIntConverter x:Key="StringToIntConverter" />
            <local:StringToDblConverter x:Key="StringToDblConverter" />
            <local:SettingValueTemplateSelector x:Key="SettingValueTemplateSelector" >
                <local:SettingValueTemplateSelector.BooleanTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <telerik:RadRadioButton IsChecked="{Binding Path=Value}">
                                <TextBlock Text="Enabled"/>
                            </telerik:RadRadioButton>
                            <telerik:RadRadioButton IsChecked="{Binding Path=Value}">
                                <TextBlock Text="Disabled"/>
                            </telerik:RadRadioButton>
                        </StackPanel>
                    </DataTemplate>
                </local:SettingValueTemplateSelector.BooleanTemplate>
                <local:SettingValueTemplateSelector.IntTemplate>
                    <DataTemplate>
                        <telerik:RadNumericUpDown Value="{Binding Path=Value, Converter={StaticResource StringToIntConverter}}" NumberDecimalDigits="0"/>
                    </DataTemplate>
                </local:SettingValueTemplateSelector.IntTemplate>
                <local:SettingValueTemplateSelector.DoubleTemplate>
                    <DataTemplate>
                        <telerik:RadNumericUpDown Value="{Binding Path=Value,Converter={StaticResource StringToDblConverter}}" />
                    </DataTemplate>
                </local:SettingValueTemplateSelector.DoubleTemplate>
                <local:SettingValueTemplateSelector.StringTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=Value, Mode=TwoWay}" />
                    </DataTemplate>
                </local:SettingValueTemplateSelector.StringTemplate>
            </local:SettingValueTemplateSelector>
 
        </Grid.Resources>
        <telerik:RadGridView x:Name="RadGridView" GroupRenderMode="Flat"
                             RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False"
                             ItemsSource="{Binding ElementName=Window1, Path=List}"
                             IsReadOnly="false"
                             ScrollMode="Deferred"
                             AutoExpandGroups="True"
                             AutoGenerateColumns="false" Margin="0,2,0,-2">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn
                    Header="Value"
                    IsGroupable="True"                   
                    DataMemberBinding="{Binding Value}" 
                    CellTemplateSelector="{StaticResource SettingValueTemplateSelector}"
                    Background="LightGray">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn
                    Header="ValueType"
                    IsGroupable="True"                   
                    DataMemberBinding="{Binding ValueType}"                   
                    Background="LightGray">
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
Template selector:
public class SettingValueTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is DataObjecten)
            {
                DataObjecten model = item as DataObjecten;
 
                if (model.ValueType == typeof(int))
                    return this.IntTemplate;
                else if (model.ValueType == typeof(String))
                    return this.StringTemplate;
                else if (model.ValueType == typeof(double))
                    return this.DoubleTemplate;
                else if (model.ValueType == typeof(bool))
                    return this.BooleanTemplate;
                else
                    return null;
            }
            return null;
        }
}

One of the converters (basic):
public class StringToIntConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        int retValue=0;
        if (int.TryParse(value.ToString(), out retValue))
        {
            return retValue;
        }
        else
            return 0;
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
          throw new NotSupportedException("Do not use this converter for objects other than boolean");
    }
}

Model:
public class DataObject
  {
      public object Value { get; set; }
      public Type ValueType { get; set; }
  }
 
          List.Add(new DataObject() { Value = "8", ValueType = typeof(int) });
          List.Add(new DataObject() { Value = "8", ValueType = typeof(double) });
          List.Add(new DataObject() { Value = "8gf", ValueType = typeof(string) });
          List.Add(new DataObject() { Value = 454365, ValueType = typeof(int) });
          List.Add(new DataObject() { Value = false, ValueType = typeof(bool) });

Nedyalko Nikolov
Telerik team
 answered on 02 Sep 2013
1 answer
199 views
Hi,

I'm having troubles with the onMouseEnter and onMouseLeave for the RadTreeViewItems.

Each time the mouse is over an item I need to show an image ("Gear")  beside this RadTreeviewItem. I'm showing this image with the onMouseEnter event and i'm hiding it with the onMouseLeave event. The problem is when i select a RadTreeViewItem that is inside another RadTreeViewItem. It shows its "Gear" and also its father "Gear".

The event is fired by the item that got the mouseOver and by all its fathers. the event should be fired only by the item with the mouse over.

can you please advise me?

thanks



Pavel R. Pavlov
Telerik team
 answered on 02 Sep 2013
2 answers
252 views
I'm working with a RadMaskedCurrencyInput control for the first time. It's bound to a SmallMoney column in a SQL Server 2008 R2 Express database, and it's hosted in a WPF DataGrid.

First question, I've removed the underlines, by changing the Placeholder property to " ". That works fine. NOw, how do I remove the thousands separator? Right now it looks a little funny, when there's something like $86.00 in the database. It looks like this: "$ , 86.00" (without the double quotes).

Second (this is more of a question concerning the interaction between the RadMaskedCurrencyInput control and the WPF DataGrid control), how many data templates do I have to specify within the DataGridTemplateColumn? This data grid needs to be able to display data, allow the user to edit the data, delete it and insert new data; basically normal CRUD operations. In order to help I'll show you what the XAML looks like right now:

<DataGridTemplateColumn x:Name="amountEarnedColumn" Header="Amount Earned" Width="SizeToHeader">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}" Mask="c5.2" Placeholder=" " />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

Third, the AmountEarned column that is bound to, is not nullable. But $0.00 is a valid value, so how do I specify a default value of $0.00 when the user creates a new row?
Pavel R. Pavlov
Telerik team
 answered on 02 Sep 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
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
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
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?