Telerik Forums
UI for WPF Forum
2 answers
39 views
I have a RadPanel which won't float when you right click its header and click "Float".  CanFloat is true.

Has anyone encountered this?

Chris
Christopher
Top achievements
Rank 1
 answered on 11 Jan 2013
1 answer
74 views
(sorry for my bad english)

With a List<T> where T is:

class Data
{
    public string Product { get; set; }
    public decimal Quantity { get; set; }
    public decimal Reserved { get; set; }
}

how can I create a chart like the image attached?

Looking on the sample it is clear that if I create 2 collections, one returning Product/Quantity and another returning Product/Reserved, I can accomplish that. But is it possible with only one collection with all the data?
Missing User
 answered on 11 Jan 2013
1 answer
118 views
The Working with RadSplitButton Items webpage shows a DefaultItem property for RadSplitButton. Is this available in the WPF RadSplitButton? It doesn't appear so.

I have the need for this functionality in our MVVM WPF application (using Caliburn Micro as our MVVM framework).

In the Style for this control, I can set a property as shown below:

<Setter Property="cal:Message.Attach" Value="[Event Click]=[Action CreateNewLink2]"/>

CreateNewLink2 is fired when I click the button without dropping down the control, but if I create a guard property for this method, the entire control is disabled. I need the dropdown to dropdown even when the guard property prevents executing the command (CreateNewLink2) since there are commands on the dropdown that can be enabled even when the CreateNewLink2 (command for the button) is disabled.

Can this be done?
Pavel R. Pavlov
Telerik team
 answered on 11 Jan 2013
1 answer
217 views
Hi,

I try to build a layout defined in the sample image attached.
The principle is that each module has a fixed position, but the size can be changed by the user, in a min / max range.

Here is my code :
<Window x:Class="WpfApplication2.MainWindow"
        Title="MainWindow">
    <Window.Resources>
        <Style x:Key="DefaultRadPaneStyle"
               TargetType="telerik:RadPane">
            <Setter Property="Focusable"
                    Value="False" />
            <Setter Property="PaneHeaderVisibility"
                    Value="Collapsed" />
            <Setter Property="CanUserClose"
                    Value="False" />
            <Setter Property="CanFloat"
                    Value="False" />
            <Setter Property="CanDockInDocumentHost"
                    Value="False" />
            <Setter Property="CanUserPin"
                    Value="False" />
            <Setter Property="IsPinned"
                    Value="True" />
            <Setter Property="ContextMenuTemplate"
                    Value="{x:Null}" />
        </Style>
    </Window.Resources>
    <Grid>
        <telerik:RadDocking x:Name="docking"
                            AllowUnsafeMode="True">
            <telerik:RadDocking.DocumentHost>
                <Grid />
            </telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer Orientation="Vertical"
                                       InitialPosition="DockedLeft"
                                       Width="300"
                                       MinWidth="100"
                                       MaxWidth="400">
                <telerik:RadPaneGroup MinHeight="100"
                                      MaxHeight="300">
                    <telerik:RadPane Style="{StaticResource DefaultRadPaneStyle}" />
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup>
                    <telerik:RadPane Style="{StaticResource DefaultRadPaneStyle}" />
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup>
                    <telerik:RadPane Style="{StaticResource DefaultRadPaneStyle}" />
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer Orientation="Horizontal"
                                       InitialPosition="DockedBottom"
                                       Height="300"
                                       MinHeight="100"
                                       MaxHeight="400">
                <telerik:RadPaneGroup>
                    <telerik:RadPane Style="{StaticResource DefaultRadPaneStyle}">
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup>
                    <telerik:RadPane Style="{StaticResource DefaultRadPaneStyle}">
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup>
                    <telerik:RadPane Style="{StaticResource DefaultRadPaneStyle}">
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
    </Grid>
</Window>

Is this the good way to achieve this?
How can I specify the min and max size (height or width) for the RadPaneGroup ? (the given example has unexpected behaviour, as in the second capture)

Regards
Philippe


Vladi
Telerik team
 answered on 11 Jan 2013
5 answers
339 views
I have a RadSplitButton on my form.  The RadSplitButton's DropDownContent contains a RadContextMenu.  Here's a snippet of the xaml:

<telerik:RadSplitButton Background="{DynamicResource ButtonBackground}"
                        Click="MisreadButton_Click"
                        CloseOnEscape="False"
                        Content="INCORRECT"
                        DropDownIndicatorVisibility="Visible"
                        DropDownPlacement="Top"
                        FontSize="20"
                        FontWeight="Bold"
                        Foreground="{DynamicResource ButtonForeground}"
                        Height="60"
                        HorizontalAlignment="Right"
                        IsEnabled="False"
                        Margin="10"
                        Name="IncorrectButton"
                        VerticalAlignment="Center"
                        Width="200">
    <telerik:RadSplitButton.DropDownContent>
        <tl:RadContextMenu DisplayMemberPath="Value"
                           ItemsSource="{Binding Path=RejectionReasons, RelativeSource={RelativeSource AncestorType={x:Type c:AlarmsDialog}}}"
                           tl:RadMenuItem.Click="RadContextMenu_ItemClick" />
        </telerik:RadSplitButton.DropDownContent>
</telerik:RadSplitButton>
In the Window's constructor, after calling InitializeComponent, I create an ObservableCollection and assign it to RejectionReasons.  I then populate that ObservableCollection with ItemChoice objects:

public class ItemChoice<TKey> : INotifyPropertyChanged {
      
    private TKey iKey;
    public TKey Key {
        get { return iKey; }
        set {
            iKey = value;
            if ( PropertyChanged != null ) {
                PropertyChangedEventArgs e = new PropertyChangedEventArgs( "Key" );
                PropertyChanged( this, e );
            }
        }
    }
  
    private string iValue = string.Empty;
    public string Value {
        get { return iValue; }
        set {
            iValue = value;
            if ( PropertyChanged != null ) {
                PropertyChangedEventArgs e = new PropertyChangedEventArgs( "Value" );
                PropertyChanged( this, e );
            }
        }
    }
  
    public ItemChoice() {}
  
    public ItemChoice( TKey key, string value ) {
        Key = key;
        Value = value;
    }
  
    public ItemChoice( KeyValuePair<TKey, string> item ) {
        Key = item.Key;
        Value = item.Value;
    }
  
    public override string ToString() {
        return Value.ToString();
    }
  
    public static explicit operator KeyValuePair<TKey, string>( ItemChoice<TKey> item ) {
        return new KeyValuePair<TKey, string>( item.Key, item.Value );
    }
  
    public event PropertyChangedEventHandler  PropertyChanged;
}
 
But the RadContextMenu's Items collection remains empty, even after I populate the collection.  I use this same ItemChoice class with ComboBoxes and ListBoxes and it works fine.  What am I doing wrong?

Also, in my RadMenuItem.Click handler, how do I get a reference to the ItemChoice that generated the RadMenuItem?  It's not at all clear to me from the properties that are available in that class.

Tony
Tina Stancheva
Telerik team
 answered on 11 Jan 2013
1 answer
79 views
Hi we are having some performance problems with using a few instances of the scheduleView.
How can I send you a demo project which demonstrates the problem?
TNX
Vladi
Telerik team
 answered on 11 Jan 2013
1 answer
154 views
Hi,

We are on the design stage for a WPF Prism application, and we want to provide an editor functionality similar to MS Word in one of our modules. We have a toolbar region in the top of the page that should load the module containing the RadRichTextBoxRibbonUI, and a content region in the middle of the screen that should load the module containing the RadRichTextbox for editing. So the Rich Textbox and its Ribbon are in 2 separate module for loose coupling. In the WPF demo examples, the commands in Ribbon are bound the RichTextbox in XAML (i.e. DataContext and Commands). Is there any suggestion how can we implement our design? Can we pass a reference of the RichTextbox and do the necessary binding in the code at load time of the ribbon?

Any hints would be appreciated!

Regards
Boby
Telerik team
 answered on 11 Jan 2013
1 answer
169 views
Dear all who has a knowlege of Heatmap control.

I want to create a heatmap onto a image file. Is it possible to create a heatmap which is having background image?
Petar Marchev
Telerik team
 answered on 11 Jan 2013
2 answers
408 views
Here is the xaml:
<UserControl x:Class="Example.ScatterPlotPanel"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:Exponent.Sensor.Pet.Analysis"
         xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
         x:Name="_this"
             >
    <Grid>
        <telerik:RadPolarChart x:Name="chart" StartAngle="90">
            <telerik:RadPolarChart.Grid>
                <telerik:PolarChartGrid GridLineVisibility="Both" StripesVisibility="Radial">
                    <telerik:PolarChartGrid.RadialStripeBrushes>
                        <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" />
                        <SolidColorBrush Color="Transparent" />
                    </telerik:PolarChartGrid.RadialStripeBrushes>
                </telerik:PolarChartGrid>
            </telerik:RadPolarChart.Grid>
  
            <telerik:RadPolarChart.RadialAxis>
                <telerik:NumericRadialAxis ShowLabels="False" />
            </telerik:RadPolarChart.RadialAxis>
  
            <telerik:RadPolarChart.PolarAxis>
                <telerik:PolarAxis Minimum="0" />
            </telerik:RadPolarChart.PolarAxis>
              
            <telerik:RadPolarChart.Series>
                <telerik:PolarPointSeries x:Name="series" ItemsSource="{Binding ElementName=_this, Path=DataPoints}" AngleBinding="MissAngleDegrees" ValueBinding="MissDistanceMeters">
                    <telerik:PolarPointSeries.PointTemplate>
                        <DataTemplate>
                            <Ellipse Height="4" Width="4">
                                <Ellipse.Style>
                                    <Style TargetType="Ellipse">
                                        <Setter Property="Fill" Value="Red"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding Path=DataItem.IsHit}" Value="True">
                                                <Setter Property="Fill" Value="Green"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Ellipse.Style>
                            </Ellipse>
                        </DataTemplate>
                    </telerik:PolarPointSeries.PointTemplate>
                </telerik:PolarPointSeries>
            </telerik:RadPolarChart.Series>
        </telerik:RadPolarChart>
        <Button Content="Test" Click="OnUpdateDataPoints"/>
    </Grid>
</local:AnalysisPanel>

Here is the code behind:
public class AlarmData
    {
        private double missDistance;
        private double missAngle;
        private bool isHit;
 
        public AlarmData()
        {
        }
 
        public AlarmData(bool isHit, double missDistance, double missAngle)
        {
            this.isHit = isHit;
            this.missDistance = missDistance;
            this.missAngle = missAngle;
        }
 
        public bool IsHit
        {
            get { return isHit; }
            set { isHit = value; }
        }
 
        public double MissDistanceMeters
        {
            get { return missDistance.Meters; }
        }
 
        public double MissAngleDegrees
        {
            get { return missAngle.Degrees; }
        }
    }
 
    public partial class ScatterPlotPanel : UserControl, INotifyPropertyChanged
    {
        private List<AlarmData> dataPoints = new List<AlarmData>();
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        public ScatterPlotPanel()
        {
            InitializeComponent();
        }
 
        protected void OnPropertyChanged(string propertyName)
        {
            try
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
            }
            catch (Exception ex)
            {
            }
        }
 
        protected override void OnUpdateDataPoints(object sender, RoutedEventArgs e)
        {
            dataPoints.Clear();
 
            Random random = new Random();
            for (int i = 0; i < 100; i++)
            {
                dataPoints.Add(new AlarmData(random.Next(0, 2) != 0, Distance.FromCentimeters(random.Next(0, 400)), Angle.FromDegrees(random.Next(0, 359))));
            }
 
            OnPropertyChanged("DataPoints");
        }
 
        public List<AlarmData> DataPoints
        {
            get { return dataPoints; }
        }
    }

The problem is when I click the Test button in the example the series does not refresh. This is a simplified example of what we are trying to do but would like the ItemsSource property of the series to behave like it should and update if the binding changes. Any help on this issue is appreciated.
Christopher
Top achievements
Rank 1
 answered on 10 Jan 2013
3 answers
221 views
I have a scenario in which I have a ViewModel of a particular type that can hold a Model that can be one of a set of types.

The ViewModel inherits from DynamicObject to expose elements within the Model as properties for the PropertyGrid. In my DynamicObject implementation I am overriding GetDynamicMemberNames, TryGetMember, and TrySetMember. I am keeping my own dictionary of member names and accessors within my ViewModel.

The underlying Model may have different members so that each instance of the ViewModel should appear to have different properties.

I have a list of instances of the ViewModel and the PropertyGrid is bound to the list's selected item. When I switch items, WPF databinding makes calls to TryGetMember within the newly selected ViewModel. However, when that set of calls are made, they're based on the member names returned by the previous instance.

So let's say I have Model1 with properties A, B, C and Model 2 with properties D, E, F. Instances of either can be held in an instance of my dynamic ViewModel. I add an instance of each to the list. I select the item containing the instance of Model1, the PropertyGrid shows three properties A, B, C just fine. When I select the item containing Model2 however, I get an error within my TryGetMember saying that the key isn't found, I look at the binder.Name and it's reading "A" even though this new instance of ViewModel has a model of type Model2 with only the properties D, E, F.

When I switch between these two items, GetDynamicMemberNames() isn't called more than once. I suspect that somewhere along the way the member names are being cached by the name of the type they're associated with. So in this internal cache someplace it's associating my ViewModel class with properties A, B, C and uses that cache to query all instances of ViewModel.

My questions are:

1) Do you know where this caching is happening? Is this in PropertyGrid, in WPF databinding, or within the DynamicObject base class?

2) Is there any way to override the member name caching?

3) Is there any way to force a call to GetDynamicMemberNames() each time a new instance of my ViewModel is loaded into the PropertyGrid?

Thanks for your help.

Matt
Ivan Ivanov
Telerik team
 answered on 10 Jan 2013
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?