Telerik Forums
UI for WPF Forum
1 answer
241 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
395 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
98 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
176 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
204 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
440 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
239 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
2 answers
532 views
I have a RadTreeView inside a ScrollViewer.

When the mouse wheel is scrolled over the RadTreeView the parent ScrollViewer does not scroll.

Is there an easy way to change this behavior that I'm missing (or a hard way for that matter)?

Ed
Edward
Top achievements
Rank 1
 answered on 10 Jan 2013
5 answers
594 views
Hi,

I have been given the task of rewriting an old application, and I'd like to use the RadControls for some parts of it. In this application, the user has to be able to place items on a schematic view, like this.

I have a couple of questions though, because I wasn't able to figure out how to do the following things from the RadDiagram Help/Tutorials, as I am quite new to more advanced WPF stuff (have only written relatively simple apps before) and MVVM in general:

1. How can I create diagram objects (for starters, they can just be rectangles) that simply have an Image control with their respective Bitmap set as the source (so I can get objects like in the screenshot by using the bitmaps that I have and avoid having to write their Geometry in WPF), with multiple connectors on each side (like the ISDN block in the lower right corner), and a Dictionary for each instance of an object to store custom properties? I've been through the "How To Create Custom Shape" tutorial, but still don't really know how to tackle this problem.

2. How do I add these objects to the toolbox later on? Do I just create a Gallery (ObservableCollection) with those Shapes and add that to the item ObservableCollection of my ViewModel?

Thanks
Tina Stancheva
Telerik team
 answered on 10 Jan 2013
2 answers
158 views
private void diagram_ConnectionManipulationStarted(object sender, ManipulationRoutedEventArgs e)
{
    MyShape source = e.Connection.Source as MyShape;
    // source.MyData == null?
}

We're trying to add logic for connection manipulation. Why isn't our custom data set in this event when it is indeed set for our nodes in the graph?
Kristoffer
Top achievements
Rank 1
 answered on 10 Jan 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
LayoutControl
ProgressBar
Sparkline
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
Callout
Rating
Accessibility
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?