Telerik Forums
UI for WPF Forum
1 answer
182 views
Hi,

I realize this may be a newbie question but I've never worked with themes before.  The examples I've found on the Internet haven't worked for me when trying to get Telerik themes to work.  Is there a step-by-step document that covers what xaml files to import to get the themes to work?  I have a pretty simple demo I'm creating that uses the Carousel control and I want to apply a Windows 8 WPF Touch theme.  Here is the code from App.xaml:  I also added a reference to Telerik.Windows.Controls.Navigation.xaml in my project but I'm getting a ton of errors when I build the project.
<Application.Resources>
    <ResourceDictionary Source="/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
</Application.Resources>
Vlad
Telerik team
 answered on 14 Nov 2012
1 answer
190 views
Hi,

I'm evaluating telerik diagrams for a WPF app that will allow users to model a network comms room. I think so far it looks great and fits the bill, but I have a couple of specific things I'm trying to do that because I'm new to WPF and Telerik, I'm struggling with.

1) In the toolbox, I want to be able to drag racks into the canvas area, a rack could just be a rectangle with special attributes. Is is possible to allow for a shape to map to a domain model like a rack? And could I use the properties dialog thing to collect all the details, for example rack name, rack size etc.. ? Sorry I don't know what the name is for that properties dialog thing that I've seen on the demos, but I can't work out how to make one appear

2) Once I 've got a rack on the canvas, I then want to be able to drag multiple "switches" or "patch panels" into the rack, and again set properties. Is is possible to make the rack act as a container for these other objects? 

Any pointers or snippets would be grateful - getting to grips with this whilst learning WPF and MVVM is quite tricky!

Thanks!

Matt
Tina Stancheva
Telerik team
 answered on 13 Nov 2012
2 answers
132 views
Dear Telerik Team!

I have successfuly implemented drag and drop operation between ListBox and ScheduleView. I use custom appointment. Everything works fine when my custom appointment inherits from Appointment class. Unfortunately I need to use a class which inherits from EntityObject class so my custom appointment class must implement IAppointment interface instead of inheriting Appointment base class. After that drag and drop stopped working. Could you please provide me with some samples of correct IAppointment interface implementation. You can find a class I use for now down below:
public class WMSAppointment : IAppointment
    {
        public string Body { get; set; }
        public ICategory Category { get; set; }
        public Importance Importance { get; set; }
        public DateTime End { get; set; }
        public DateTime Start { get; set; }
        public string Subject { get; set; }
        public IList Resources { get; set; }
        public int JobId { get; set; }
        public bool IsAllDayEvent { get; set; }
        public IRecurrenceRule RecurrenceRule { get; set; }
        public ITimeMarker TimeMarker { get; set; }
        public TimeZoneInfo TimeZone { get; set; }
 
        public event EventHandler RecurrenceRuleChanged;
        public event PropertyChangedEventHandler PropertyChanged;
 
        public bool Equals(IAppointment other)
        {
            var otherAppointment = other as WMSAppointment;
            return otherAppointment != null &&
                other.Start == this.Start &&
                other.End == this.End &&
                other.Subject == this.Subject &&
                this.JobId == otherAppointment.JobId &&
                this.TimeMarker == otherAppointment.TimeMarker &&
                this.TimeZone == otherAppointment.TimeZone &&
                this.IsAllDayEvent == other.IsAllDayEvent &&
                this.RecurrenceRule == other.RecurrenceRule;
        }
 
        public void BeginEdit()
        {
            throw new NotImplementedException();
        }
 
        public void CancelEdit()
        {
            throw new NotImplementedException();
        }
 
        public void EndEdit()
        {
            throw new NotImplementedException();
        }
 
        public IAppointment Copy()
        {
            IAppointment appointment = new WMSAppointment();
            appointment.CopyFrom(this);
 
            return appointment;
        }
 
        public void CopyFrom(IAppointment other)
        {
            this.IsAllDayEvent = other.IsAllDayEvent;
            this.Start = other.Start;
            this.End = other.End;
            this.Subject = other.Subject;
 
            var otherAppointment = other as WMSAppointment;
            if (otherAppointment == null)
                return;
 
            this.JobId = otherAppointment.JobId;
            this.TimeMarker = otherAppointment.TimeMarker;
 
            this.Resources.Clear();
            this.Resources.AddRange(otherAppointment.Resources);
 
            this.Body = otherAppointment.Body;
        }
    }


Thank you very much and best regards
Krzysztof Kaźmierczak
Krzysztof
Top achievements
Rank 1
 answered on 13 Nov 2012
4 answers
274 views
Hi guys,

I'm actually displaying my RadGridView row details in a DetailPresenter (working withRadControls for WPF Q3 2012).
Each rows can be of different types, therefore, I use a template selector to display details. Templates are hosting user controls connected to ViewModels, instantiating in there own codebehind in onrender methods:

Mainwindow.xaml:
   
<Grid VerticalAlignment="Top">
       <Grid.Resources>
           <DataTemplate x:Key="KidDataTemplate">
                   <View:KidView KidId="{Binding Id}" />
           </DataTemplate>
           <DataTemplate x:Key="AdultDataTemplate">
                   <View:AdultView AdultId="{Binding Id}" />
           </DataTemplate>
           <selectors:UserDataTemplateSelector x:Key="UserDataTemplateSelector" />
       </Grid.Resources>
       <StackPanel Orientation="Vertical">
           <telerik:RadGridView x:Name="grid1"
                                    HorizontalAlignment="Left"
                                    Margin="10,10,0,0"
                                    VerticalAlignment="Top"
                                    RowDetailsTemplateSelector="{StaticResource UserDataTemplateSelector}"
                                    RowDetailsVisibilityMode="Collapsed"
                                    AutoGenerateColumns="True"/>
           <Border Grid.Row="1"  BorderBrush="WhiteSmoke" BorderThickness="5">
               <telerik:DetailsPresenter DetailsProvider="{Binding RowDetailsProvider, ElementName=grid1}" />
           </Border>
       </StackPanel>
   </Grid>

AdultView.xaml.cs:

public partial class AdultView : UserControl
    {
 
        public int? AdultId
        {
            get { return (int?)GetValue(AdultIdProperty); }
            set { SetValue(AdultIdProperty, value); }
        }
        public static readonly DependencyProperty AdultIdProperty = DependencyProperty.Register("AdultId", typeof(int?), typeof(AdultView));
         
        public AdultView()
        {
            InitializeComponent();
        }
         
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            if (AdultId.HasValue)
            {
                this.DataContext = new RowDetailSample.ViewModel.AdultViewModel(AdultId.Value);
            }
        }
 
    }


This works quite well until I'm selecting a second line of the same type:
The user control placed in the selected template does not update it's binding handled by its ViewModel.

Do I implement things correctly(is onrender method the right place to instanciate the viewModel object)? Do I miss something?

Thanks for your help.
Kind regards,
JC
Jc
Top achievements
Rank 1
 answered on 13 Nov 2012
1 answer
367 views
Hello,

How can I show a specific text string when a RadListBox instance is empty?

I tried defining a style to accomplish this goal, like this:

<Style TargetType="telerik:RadListBox" x:Key="ListStyle" BasedOn="{StaticResource {x:Type telerik:RadListBox}}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Margin" Value="0, 20, 0, 0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <TextBlock Foreground="DimGray" TextWrapping="Wrap" FontSize="14">
                            There are currently no items to show.
                        </TextBlock>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </DataTrigger>
    </Style.Triggers>
</Style>

I then attach it to the RadListBox instance:

<telerik:RadListBox  Style="{StaticResource ListStyle}">
   // items here
</telerik:RadListBox>

This actually works, for the most part... but it has a fatal flaw - the RadListBox scrollbars are no longer correctly themed.

Is there another way of accomplishing this goal? Or could I get some help in tweaking the style above so that the vertical scrollbar has the correct "Windows7" theme applied to it?
Masha
Telerik team
 answered on 13 Nov 2012
2 answers
322 views
Hi,

I made a categorical chart with a bar series definition and a line series definition. The x-axis label always seems to be the category name. How can I change it to something else? I have a custom class with various properties such as XValue, YValue, XCategory and Label. I have tried a few different things as suggested in other posts on the forum, but they don't seem to work and the item on the x-axis is always labelled according to the category.

I have tried setting the item label format in the series mapping (I tried #LABEL and "#DATAITEM.Label") and I have added the item mappings as well, but it still shows the XCategory instead of the label.

var seriesDefinition = new BarSeriesDefinition
            {
                ShowItemLabels = false,
                ShowItemToolTips = true,
                ItemToolTipFormat = "#DATAITEM.Label",
                ItemLabelFormat = "#DATAITEM.Label",
                EmptyPointBehavior = emptyPointBehavior
            };

seriesMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));            
seriesMapping.ItemMappings.Add(new ItemMapping("XCategory", DataPointMember.XCategory));
seriesMapping.ItemMappings.Add(new ItemMapping("Label", DataPointMember.Label));

I have also tried the following:

chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#DATAITEM.Label"; and chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#LABEL"; 

Any help would be appreciated.
Petar Kirov
Telerik team
 answered on 13 Nov 2012
0 answers
115 views
  Hi EveryOne!
      i'm from china. person don't use English very often.
How to can the Controls language. pls look the pics.            
Zhang
Top achievements
Rank 1
 asked on 13 Nov 2012
6 answers
665 views
I am trying to change the track ball info, but I cannot figure out the right combination to get the data to come out the way I need it to come out. I want to show an identifier for a line series in much the same way that the ChartView demo does, but in that demo, the series and format strings are encoded into the XAML. In my app, there can be any number of line series, so they need to be created programmatically.

Here is the class that holds the data:
public class SalesInfo
{
    public string Employee { get; set; }
    public DateTime Time { get; set; }
    public int Value { get; set; }
}

And here is where I am creating the data and setting the item source of my line series:
data = new RadObservableCollection<SalesInfo>(data.OrderBy(x => x.Time));
 
Color dataColor = colorArray[loopCounter % 4];
 
LineSeries line = new LineSeries();
line.Stroke = new SolidColorBrush(dataColor);
line.StrokeThickness = 2;
line.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Time" };
line.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
line.ItemsSource = data;
var tbiTemplate = this.Resources["theTemplate"] as DataTemplate;
line.TrackBallInfoTemplate = tbiTemplate;
activitiesAddedChart.Series.Add(line);

And finally the template in the resources:
<DataTemplate x:Key="theTemplate">
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding DataPoint.SalesInfo.Employee}" />
        <TextBlock Text=": " />
        <TextBlock Text="{Binding DataPoint.Value}" />
    </StackPanel>
</DataTemplate>

I cannot figure out how to get this bound correctly so that I can see the Employee name in the track ball info. I get the Value fine, and if I use DataPoint.Category, I can get the date, but I just cannot figure out how to get the Employee to show up in that first TextBlock in the template. Thanks.

Tsvetie
Telerik team
 answered on 13 Nov 2012
1 answer
123 views
Hi, 
I use 2 screens and when I implement keytips they don't appear in the right position related to my application.
(I open up my application on my right screen, the "main display screen", but when I trigger the keytips they appear on my left screen...!)

Are there any settings I have to apply to "connect" the keytips to my application in any way...so that they always appear "in the right position" related to my app?

I've enabled keytips in my xaml and in the code-behind file I do this:
var keyGesture = new KeyGesture(Key.LeftAlt);
ribbon.SetValue(KeyTipService.AccessKeyProperty, keyGesture);
Stefan
Telerik team
 answered on 13 Nov 2012
3 answers
152 views

1.In the radrichtextbox , setting the page number, from 1 to N, it could be shown in the radrichtextbox correctly, but when calling window's printing function, all the pages's number is 1.

2.How to transter the Landscape of PrintDialog to the RadRichTectBox.

Robert
Top achievements
Rank 1
 answered on 12 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?