Telerik Forums
UI for WPF Forum
5 answers
93 views

Hi,

When I change the Alpha value (via slider or textbox) to something other than 100%

the LuminancePad goes black and white. the color return only when the alpha value is 100%.

is there a way to override this behavior?

Attached files to demonstrate.

I cannot attach an example project. but what I did was to create new wpf project. added the RadColorEditor, and changed the active sections to HueSaturationPad,LuminancePad,ColorModesPanel.

Thanks.

 

Sia
Telerik team
 answered on 18 Dec 2015
1 answer
63 views

I'm using my boss old telerik version, i try to make new View Model in my new solution and i got this error :

SeverityCodeDescriptionProjectFileLineSuppression State
ErrorCS0433The type 'AppointmentDeletedEventArgs' exists in both 'Telerik.Windows.Controls.ScheduleView, Version=2011.2.712.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' and 'Telerik.Windows.Controls.Scheduler, Version=2011.2.712.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'

 In my previous work i dont have any problem but suddenly i got this problem. what happen and how can i fix this?

 

Geri
Telerik team
 answered on 18 Dec 2015
6 answers
237 views

Hi,

How can i disable this action?

In your ScheduleView sample, i can drop out (in notepad...) of the window application.

I try to override the CanDrop function in ScheduleViewDragDropBehavior with "state" parameter but couldn't do this.

I didn't find hook to fire drop cancel when it happens...

Nasko
Telerik team
 answered on 18 Dec 2015
7 answers
283 views
I am using candlestick chart and adding two dataseries on the same chart.

what I expect is individual candlestick (from two series) should align next to each other (if they belong to same XCategory value). However, I could see they overlap on top of each other.

see attached (expected).

I am using following code:

 

private void FillSampleChartData()

 

{

 

XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection<Temporal>));

 

 

using (StreamReader wr = new StreamReader("TemporalDataNew.xml"))

 

{

TemporalData = xs.Deserialize(wr)

as ObservableCollection<Temporal>;

 

}

 

DataSeries cs = new DataSeries();

 

cs.Definition =

new CandleStickSeriesDefinition();

 

 

DataSeries ps = new DataSeries();

 

ps.Definition =

new CandleStickSeriesDefinition();

 

 

DataSeries ls = new DataSeries();

 

ls.Definition =

new LineSeriesDefinition();

 

 

CoMorbidityChartData = TemporalData.Where<

Temporal>(f => f.Id == "CoMorbidityChartDetail").ToList<Temporal>();

 

 

int count = 1;

 

 

foreach (TemporalItem ti in CoMorbidityChartData[0].TemporalItem)

 

{

 

DataPoint dpPopulation = new DataPoint();

 

dpPopulation.XCategory = ti.Id;

dpPopulation.Low =

Convert.ToDouble(ti.Readings[0].Low);

 

dpPopulation.High =

Convert.ToDouble(ti.Readings[0].High);

 

dpPopulation.Close =

Convert.ToDouble(ti.Readings[0].Close);

 

dpPopulation.Open =

Convert.ToDouble(ti.Readings[0].Open);

 

 

DataPoint dpLine = new DataPoint();

 

dpLine.YValue =

Convert.ToDouble(ti.Readings[0].Open);

 

 

ls.Add(dpLine);

cs.Add(dpPopulation);

count++;

}

 

 

foreach (TemporalItem ti in CoMorbidityChartData[0].TemporalItem)

 

{

 

DataPoint dpCriteria = new DataPoint();

 

dpCriteria.XCategory = ti.Id;

dpCriteria.Low =

Convert.ToDouble(ti.Readings[1].Low);

 

dpCriteria.High =

Convert.ToDouble(ti.Readings[1].High);

 

dpCriteria.Close =

Convert.ToDouble(ti.Readings[1].Close);

 

dpCriteria.Open =

Convert.ToDouble(ti.Readings[1].Open);

 

 

ps.Add(dpCriteria);

}

 

this.RadChart1.DefaultView.ChartArea.DataSeries.Add(cs);

 

 

this.RadChart1.DefaultView.ChartArea.DataSeries.Add(ps);

 

 

}



 
Petar Marchev
Telerik team
 answered on 18 Dec 2015
1 answer
89 views

I'm working on a solution where I have to drag and appointment from a RadScheduleView to a RadGridView.

At present, I reached to drag from RadScheduleView to RadGridView but unfortunately the appointment is removed from the RadScheduleView instead. That not what i want, I just want to drag a copy of the appointment.

I have search the internet and forums, but i have not found any solutiuons to solve my problem.

Can anyone help?

Thanks

Rosi
Telerik team
 answered on 18 Dec 2015
1 answer
197 views

Hi,

We have a regular GridViewSelectColumn as the left-most column in a RadGridView. The users have requested that they want to filter the grid by that column, but when I add IsFilterable="True" to it, nothing happens. No filter icon appears in the header.

Is this not possible or have I just made some mistake here?

Best regards
Mikael Börjesson

Stefan
Telerik team
 answered on 17 Dec 2015
7 answers
304 views

I'm experimenting the attribute Telerik.Windows.Controls.Data.PropertyGrid.Editor, and in your example, you show the usage of a RadColorEditor as a cusom editor.

I'm doing the same thing with a control (which currently only shows the color), but the template is not being applied. I have put the style with the template in the Themes\Generic.xaml and still nothing.

If I put an instance of that control on the XAML directory, then I see it.

 

Here is my View Model:

 

public class Person : DependencyObject , INotifyPropertyChanged
{
    public Person()
    {
        currentColor = Colors.Red;
    }
 
    private string _firstName = "Sponge";
    [Display(Name="First Name", GroupName="Details", Order = 1, Prompt="tttt"), CustomValidation(typeof(Person), "blabla"), Browsable(true)]
    public string FirstName
    {
        get { return _firstName; }
        set { _firstName = value; }
    }
    private string _lastName = "Bob";
 
    [DisplayName("Last Name"), Category("Details"), Browsable(true)]
    public string LastName
    {
        get { return _lastName; }
        set { _lastName = value; }
    }
    private string _blabla;
 
    public string Blabla
    {
        get { return _blabla; }
        set { _blabla = value; }
    }
 
    [Telerik.Windows.Controls.Data.PropertyGrid.Editor(typeof(MyEditor), "SelectedColor", Telerik.Windows.Controls.Data.PropertyGrid.EditorStyle.None), Browsable(true)]
    public Color CurrentColor
    {
        get
        {
            return this.currentColor;
        }
        set
        {
            if (this.currentColor != value)
            {
                this.currentColor = value;
                this.OnPropertyChanged("CurrentColor");
            }
        }
    }
 
    public void blabla()
    {
    }
 
 
 
    public Visibility Visibility
    {
        get { return (Visibility)GetValue(VisibilityProperty); }
        set { SetValue(VisibilityProperty, value); }
    }
 
    // Using a DependencyProperty as the backing store for Visibility.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty VisibilityProperty =
        DependencyProperty.Register("Visibility", typeof(Visibility), typeof(Person), new UIPropertyMetadata(Visibility.Visible));
 
 
 
    private Color currentColor { get; set; }
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    public void OnPropertyChanged(string propertyName)
    {
        if (propertyName != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

 

 This is the XAML:

 

<Window x:Class="TelerikPropertyGrid.MainWindow"
        xmlns:myEditors="clr-namespace:MyEditors;assembly=MyEditors"
        xmlns:local="clr-namespace:TelerikPropertyGrid"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <telerik:RadPropertyGrid x:Name="pg" DescriptionPanelVisibility="Collapsed" Item="{Binding Item}" telerik:StyleManager.Theme="Windows8" AutoGeneratingPropertyDefinition="pg_AutoGeneratingPropertyDefinition" BeginningEdit="pg_BeginningEdit" EditEnded="pg_EditEnded" FieldLoaded="pg_FieldLoaded" Grouped="pg_Grouped" ItemChanged="pg_ItemChanged" SelectionChanged="pg_SelectionChanged" SourceUpdated="pg_SourceUpdated"  />
   </Grid>
</Window>

 

 

This is the code-behind of that window:

public partial class MainWindow : Window
{
    private Person _person = new Person();
    public MainWindow()
    {
        InitializeComponent();
        this.DataContext = this;
    }
 
    public Person Item
    {
        get
        {
            return _person;
        }
    }
 
    private void pg_AutoGeneratingPropertyDefinition(object sender, Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs e)
    {
        var pd = e.PropertyDefinition;
        var desc = pd.SourceProperty.Descriptor as PropertyDescriptor;
        bool canAdd = false;
        for (int i = 0; i < desc.Attributes.Count; i++)
        {
            var att = desc.Attributes[i];
            if (att is BrowsableAttribute && (att as BrowsableAttribute).Browsable)
            {
                canAdd = true;
            }
        }
 
        if (!canAdd)
            e.Cancel = true;
 
        if (pd.DisplayName == "First Name")
        {
            pd.DisplayName = "First[Name2]";
            Binding binding = new Binding("Visibility");
            binding.Source = Item;
            BindingOperations.SetBinding(pd, PropertyDefinition.VisibilityProperty, binding);
        }
        
 
         
 
    }
 
    private void pg_BeginningEdit(object sender, Telerik.Windows.Controls.Data.PropertyGrid.PropertyGridBeginningEditEventArgs e)
    {
 
    }
 
    private void pg_EditEnded(object sender, Telerik.Windows.Controls.Data.PropertyGrid.PropertyGridEditEndedEventArgs e)
    {
 
    }
 
    private void pg_FieldLoaded(object sender, Telerik.Windows.Controls.Data.PropertyGrid.FieldEventArgs e)
    {
 
    }
 
    private void pg_Grouped(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
 
    }
 
    private void pg_ItemChanged(object sender, Telerik.Windows.Controls.Data.PropertyGrid.PropertyGridItemChangedEventArgs e)
    {
 
    }
 
    private void pg_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
    {
 
    }
 
    private void pg_SourceUpdated(object sender, DataTransferEventArgs e)
    {
 
    }
 }
 

 

The Editor, MyEditor is located on a different DLL:

MyEditor.cs... the break point of the OnApplyTemplate is never reached:

public class MyEditor : Control
{
 
    static MyEditor()
    {
        FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(MyEditor), new FrameworkPropertyMetadata(typeof(MyEditor)));
    }
 
    public MyEditor()
    {
        this.SetValue(FrameworkElement.DefaultStyleKeyProperty, typeof(MyEditor));
    }
 
    public Color SelectedColor
    {
        get { return (Color)GetValue(SelectedColorProperty); }
        set { SetValue(SelectedColorProperty, value); }
    }
 
    // Using a DependencyProperty as the backing store for SelectedColor.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty SelectedColorProperty =
        DependencyProperty.Register("SelectedColor", typeof(Color), typeof(MyEditor), new UIPropertyMetadata(Colors.White, onSelectedColorChanged));
 
 
    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
    }
 
    public static void onSelectedColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
    }

 

// This is the code of the converter

    public class ColorToBrushConverter : IValueConverter
     {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is Color)
            {
                return new SolidColorBrush((Color)value);
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
     }

}

 

 Generic.xaml located under the Themes directory

                    xmlns:local="clr-namespace:MyEditors"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 
    <local:ColorToBrushConverter x:Key="ctb" />
    <Style TargetType="{x:Type local:MyEditor}" x:Key="{x:Type local:MyEditor}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MyEditor}">
                    <Border x:Name="border" Background="{TemplateBinding SelectedColor, Converter={StaticResource ctb}}">
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

 

I can do the following code once, when the LayoutUpdated is called for the first time, but it looks dirty, and I'm sure that there are better ways:
Style ts = Application.Current.FindResource(typeof(MyEditor)) as Style;
this.Style = ts;

 

What am I doing wrong?

What am I missing, and should I do in order to see the editor in the property grid.

 

Thanks.

BENN
Top achievements
Rank 1
 answered on 17 Dec 2015
2 answers
127 views

Hello, We're trying to implement a custom formatting bar for a radrichtextbox and are having some issues with a specific command.

We are tracking the state of the users selected text by adding eventhandlers to the different commands of the radrichtextbox and all is working well, except in one case: The ChangeListStyleCommand. For some reason it seems as if the "ListStyleChangedChanged"-event is not being called when a user selects a segment of text contained (partially or completely) in a list (including an attached image to show what I mean).  

I might have a wrong understanding of how it's supposed to work, but the other commands seem to work in such fashion.

Relevant C# Code:

using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Documents.Lists;
using Telerik.Windows.Documents.Model;
using Telerik.Windows.Documents.RichTextBoxCommands;
 
namespace ...
{
    public partial class DescriptionEditor : UserControl
    {
        public DescriptionEditor()
        {
            InitializeComponent();
 
            ...
 
            InitializeEventsForTextboxes(PublicDescriptionEditor);           
        }
 
        ...
 
        private void InitializeEventsForTextboxes(params RadRichTextBox[] textboxes)
        {
            if (textboxes != null)
            {
                foreach (var textbox in textboxes)
                {
                    ...
                    // This is performed for the specific textbox.
                    // We know this since other commands are working
                    textbox.Commands.ChangeListStyleCommand.ListStyleChangedChanged += ListStyle_Changed;
                    ...
                }
            }
        }
 
        private void ListStyle_Changed(object sender, StylePropertyChangedEventArgs<ListStyle> e)
        {
            // This never gets called
            ...
        }
    }
}

Relevant XAML code:

<UserControl x:Class="... DescriptionEditor"
    x:Name="PersonDescriptionEditor">
 
    ...
 
    <telerik:RadRichTextBoxx:Name="PublicDescriptionEditor"IsSelectionMiniToolBarEnabled="False" Grid.Row="1"/>
    <telerik:HtmlDataProvider
        Html="{Binding Path=DataContext, ElementName=PersonDescriptionEditor, Mode=TwoWay}"
        RichTextBox="{Binding ElementName=PublicDescriptionEditor}">
        <telerik:HtmlDataProvider.FormatProvider>
            <telerik:HtmlFormatProvider>
                <telerik:HtmlFormatProvider.ExportSettings>
                    <telerik:HtmlExportSettings
                        DocumentExportLevel="Fragment"
                        StylesExportMode="Inline"
                        StyleRepositoryExportMode="DontExportStyles"/>
                </telerik:HtmlFormatProvider.ExportSettings>
            </telerik:HtmlFormatProvider>
        </telerik:HtmlDataProvider.FormatProvider>
    </telerik:HtmlDataProvider>
 
    ...
 
</UserControl>

Not really sure what you need to see, but the above code should contain all relevant parts


 
Petter Forss
Top achievements
Rank 1
 answered on 17 Dec 2015
2 answers
85 views

Hello,

 I use IValueConverter to calculate a column value based on other two column values. The problem is that when I edit the cell value and press Enter I get the next gridview row in IValueConverter. Do you know what the problem is? I use the code below on a UserControl.

 

this.clubsGrid.ItemsSource = EvolucionMercados.GetClubs();

public static IEnumerable<Club> GetClubs()
        {
            ObservableCollection<Club> clubs = new ObservableCollection<Club>();
            Club club;
 
            // Liverpool
            club = new Club("Liverpool", new DateTime(1892, 1, 1), 45362, 50.99f);
            club.Players.Add(new Player("Pepe Reina", 25, Position.GK, "Spain"));
            club.Players.Add(new Player("Jamie Carragher", 23, Position.DF, "England"));
            club.Players.Add(new Player("Steven Gerrard", 8, Position.MF, "England"));
            club.Players.Add(new Player("Fernando Torres", 9, Position.FW, "Spain"));
            clubs.Add(club);
 
            // Manchester Utd.
            club = new Club("Manchester Utd.", new DateTime(1878, 1, 1), 76212, 60.49f);
            club.Players.Add(new Player("Edwin van der Sar", 1, Position.GK, "Netherlands"));
            club.Players.Add(new Player("Rio Ferdinand", 5, Position.DF, "England"));
            club.Players.Add(new Player("Ryan Giggs", 11, Position.MF, "Wales"));
            club.Players.Add(new Player("Wayne Rooney", 10, Position.FW, "England"));
            clubs.Add(club);
 
            // Chelsea
            club = new Club("Chelsea", new DateTime(1905, 1, 1), 42055, 70.99f);
            club.Players.Add(new Player("Petr ÄŒech", 1, Position.GK, "Czech Republic"));
            club.Players.Add(new Player("John Terry", 26, Position.DF, "England"));
            club.Players.Add(new Player("Frank Lampard", 8, Position.MF, "England"));
            club.Players.Add(new Player("Nicolas Anelka", 39, Position.FW, "France"));
            clubs.Add(club);
 
            // Arsenal
            club = new Club("Arsenal", new DateTime(1886, 1, 1), 60355, 35.19f);
            club.Players.Add(new Player("Manuel Almunia", 1, Position.GK, "Spain"));
            club.Players.Add(new Player("Gaël Clichy", 22, Position.DF, "France"));
            club.Players.Add(new Player("Cesc Fàbregas", 4, Position.MF, "Spain"));
            club.Players.Add(new Player("Robin van Persie", 11, Position.FW, "Netherlands"));
            clubs.Add(club);
 
            return clubs;
        }

<telerik:RadGridView
            Name="clubsGrid"
            Grid.Row="0"
            AutoGenerateColumns="False">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn
                    Header="Name"
                    DataMemberBinding="{Binding Name}">
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn
                    Header="Est."
                    DataMemberBinding="{Binding Established}"
                    DataFormatString="{}{0:yyyy}">
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn
                    Header="Stadium Capacity"
                    DataMemberBinding="{Binding StadiumCapacity}"
                    DataFormatString="{}{0:N0}">
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn
                    Header="Ticket Price"
                    DataMemberBinding="{Binding TicketPrice}"
                    DataFormatString="{}{0:C2}">
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn
                    Header="Sellout Revenue"
                    DataMemberBinding="{Binding Path=., Converter={StaticResource clubToSelloutRevenueConverter}}"
                    DataFormatString="{}{0:C2}">
                    </telerik:GridViewDataColumn>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

Stefan
Telerik team
 answered on 16 Dec 2015
1 answer
121 views

Hi,

I am following the EndlessPagedCollectionView example as that closely related to what i want to achieve.

The similarity is that i need to keep loading data in batch and i don't know when it will be done.

However, it isn't truly endless. When it comes to an end, and i am at the last page, how do i disable the NEXT button in the RadDataPager? I've tried setting ItemCount / TotalItemCount but i don't seem to be able to disable the Next button while i am at the last page.

Any help?

 

btw, what's the difference between ItemCount vs TotalItemCount?

 

-A

Anthony
Top achievements
Rank 1
 answered on 16 Dec 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?