Telerik Forums
UI for WPF Forum
7 answers
229 views
Hi there,

We're moving from a single-selection model to a multi-selection model.  Using property sets with PropertySetMode of Intersection mostly works well for us, but I'm not sure how to change the following case.

The important points are:
- the business object exposes, for instance, Width and Height.
- we use a small wrapper class for each type of business object we have in the property grid.
- we'd like these two properties to appear together in the same line of the property grid as Size (see attached image).
- we want to have a more complicated view of the properties.  In this case, we want to have a little check box indicating whether the aspect ratio of Width/Height should be maintained.  We specify the DataTemplate for this view with the auto-generating-property process; however, parts of the DataTemplate no long have the correct binding.  We previously bound some parts of these DataTemplates to properties marked Browsable[false] -- these properties were so marked to prevent them from showing up as properties in the PropertyGrid but to have them available for binding in the DataTemplates we specify in the auto-generation process.  However, they don't show up in CurrentPropertySet.


here's some example pseudo-code.  PropertyChanged implementation elided.  As an aside, the main purpose of the business-object wrapper for the property grid is to capture and memento-ize property-grid changes for undo/redo (i show that here only to show why we will continue to have a wrapper).

public class BusinessObject : INotifyPropertyChanged
{
   public double Width { get; set; }
   public double Height { get; set; }
}

public class PropertyGridWrapper_for_BusinessObject : INotifyPropertyChanged
{
private BusinessObject m_BusinessObject = ...;
private Size m_Size = ...;
       
[Browsable(false)]
public double Width
{
get { return m_BusinessObject.Width; }
set
{
if (m_BusinessObject.Width != value)
{
if (PreserveAspect)
// change Height, as well
else
// change Width
}
}
}
 
[Browsable(false)]
public double Height { ... similar to Width ... }
 
public Size Size { get { return m_Size; } }
 
[Browsable(false)]
public bool PreserveAspect { get; set; }
}

then, when auto-generating property definitions, we specify the following DataTemplate for the Size property:

<DataTemplate x:Key="BusinessObjectSizePropertyGridTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Height:  " />
<TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Height}" />
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Width:  " />
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Width}" />
<Grid Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" Margin="4">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" FontFamily="Arial" Text="┐" VerticalAlignment="Bottom" Margin="0,0,0,5" />
<CheckBox Grid.Row="1" VerticalAlignment="Center" IsChecked="{Binding PreserveAspect}" />
<TextBlock Grid.Row="2" FontFamily="Arial" Text="┘" VerticalAlignment="Top" Margin="0,5,0,0" />
</Grid>
</Grid>
</DataTemplate>

using CurrentPropertySet as part of the bindings in this template doesn't work.  The bound Text property ends up being null when bound as, e.g., "CurrentPropertySet[Height]".  Do I infer correctly that the property-sets mechanism generates a dynamic object with only the browsable properties?

So, given the above example, how can we structure things to look like the image while using property sets, please?

Edit:  formatted code area
Ivan Ivanov
Telerik team
 answered on 25 Nov 2013
1 answer
119 views
Hi all,

In my application i am using the themes concept to load at runtime am able to do that,when changing from one theme to the other its taking much time i want to show some progress bar or busy indicator till the theme is loaded how can i achieve this scenario?

Thanks in Advance
Ruth
Vladi
Telerik team
 answered on 25 Nov 2013
6 answers
295 views
Hi,
By defaut CartesianPlotBandAnnotation draw the annotation from -> to plot value

I have a RadCartesianChart using a BarSeries and CategoricalAxis as HorizontalAxis. The categories represent hours (in 24 hours format) : 0 1 2 3 ... 23

If settings CartesianPlotBandAnnotation with parameters From : 6 and To : 23 the annotation starts at the middle of the 6 hour bar et 23 hour bar.

I'm searching a solution to force CartesianPlotBandAnnotation to fill 6 and 23 hours bar drawing zone.

Thanks a lot ! :)
Petar Marchev
Telerik team
 answered on 25 Nov 2013
3 answers
301 views
Hi, 

I wonder does AutocompleteBox support displaying Subscript and superscript if the autocomplete dropdown contains these values?

How to achieve that? thank you.

Vladi
Telerik team
 answered on 25 Nov 2013
0 answers
99 views
I am trying to use the grid with about 10 columns and 1000 rows.  I am bound to an Observable collection for this, though in production I'd like to move to an IQueryable binding with paging via the datapager.  Autogenerated columns are a requirement as well as the user being able to resize/move columns.  In production, we will have anywhere from 5 to 120 columns with 1000 rows and hopefully paging.  All rows are read only and the user cannot add/remove rows or edit any cells.  When clicking the scroll handle and dragging with the mouse, the scroll behavior is very very jumpy instead of being smooth.  If you scroll VERY slowly, then it's mostly smooth, but still not quite where it should be.  Even horizontal scrolling with 2 or 3 columns off the side is clunkier than it should be.  All of the demos I've seen have very smooth scrolling and that behavior is very desirable.  I have read the degraded performance articles and have put sizes on the grid row containing the radgridview so that it does not size to "infinity".  Please point me in the right direction to get smooth performance.  Below is my View, ViewModel and Model being represented.

Thank you in advance,
Mark

MainWindow.xaml
<Window
        xmlns:my="clr-namespace:TelerikGridPrototype"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="TelerikGridPrototype.MainWindow"
        Title="MainWindow" Height="720" Width="1280" WindowStartupLocation="CenterScreen"
        DataContext="{Binding MainPageViewModel, Source={StaticResource Locator}}">
    <telerik:RadBusyIndicator IsBusy="{Binding Busy}">
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="660"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <telerik:RadGridView Name="gridView" ShowGroupPanel="False" IsReadOnly="True" CanUserInsertRows="False" CanUserDeleteRows="False" AreRowDetailsFrozen="True"  Grid.Row="0" ItemsSource="{Binding Records}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        <Button HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Content="Load" Name="btnLoad" Width="100">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <ei:CallMethodAction
                    TargetObject="{Binding}"
                    MethodName="LoadDataAsync"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
    </Grid>
    </telerik:RadBusyIndicator>
</Window>

MainPageViewModel.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using PhoenixDAL.Models;
using SimpleMvvmToolkit;
using TelerikGridPrototype.Models;
 
namespace TelerikGridPrototype
{
    public class MainPageViewModel : ViewModelBase<MainPageViewModel>
    {
        public MainPageViewModel()
        {
            Records = new ObservableCollection<record>();
        }
 
        public ObservableCollection<record> Records { get; set; }
 
        private bool busy;
        public bool Busy
        {
            get { return busy; }
            set
            {
                busy = value;
                NotifyPropertyChanged(m => m.Busy);
            }
        }
 
        public event EventHandler<NotificationEventArgs<Exception>> ErrorNotice;
 
        public async void LoadDataAsync()
        {
            Busy = true;
            var q = await Task<List<record>>.Factory.StartNew
                (
                 
                    () => DAL.Instance.Phoenix.records.Take(1000).OrderByDescending(a => a.StartTime).ToList()
                );
 
            foreach (var v in q)
            {
                Records.Add(v);
            }
            Busy = false;
        }
 
        // Helper method to notify View of an error
        private void NotifyError(string message, Exception error)
        {
            Notify(ErrorNotice, new NotificationEventArgs<Exception>(message, error));
        }
    }
}

record.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
 
namespace PhoenixDAL.Models
{
    public partial class record
    {
        [DisplayAttribute(AutoGenerateField = false)]
        public long RecordID { get; set; }
        [DisplayAttribute(Name = "Channel Name")]
        public string ChannelName { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long StartTime { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long StartEMCRef { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int StartPageIndex { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int StartBlockOffset { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long EndTime { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long EndEMCRef { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int EndPageIndex { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int EndBlockOffset { get; set; }
        [DisplayAttribute(Name = "Duration")]
        public long Duration { get; set; }
        [DisplayAttribute(Name = "Source ID")]
        public int SourceID { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int SequenceIndex { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public Nullable<int> IntegrationID { get; set; }
        [DisplayAttribute(Name = "Transmission ID")]
        public string Transmission_ID { get; set; }
        [DisplayAttribute(Name = "Storage Alias")]
        public string StorageAlias { get; set; }
        [DisplayAttribute(Name = "Media Tag")]
        public Nullable<int> Media_Tag { get; set; }
        [DisplayAttribute(Name = "Media Description")]
        public string Media_Description { get; set; }
        [DisplayAttribute(Name = "Trigger Event")]
        public string Trigger_Event { get; set; }
        [DisplayAttribute(Name = "Termination Event")]
        public string Termination_Event { get; set; }
        [DisplayAttribute(Name = "Start Time")]
        public Nullable<System.DateTime> Start_Time { get; set; }
        [DisplayAttribute(Name = "End Time")]
        public Nullable<System.DateTime> End_Time { get; set; }
        [DisplayAttribute(Name = "Total Seconds")]
        public Nullable<double> Total_Seconds { get; set; }
    }
}

There is no code-behind in the xaml.cs file.
Mark
Top achievements
Rank 1
 asked on 22 Nov 2013
14 answers
309 views
Hi all,


We have a WPF application that gets deployed using click once.
This applications uses the Telerik WPF control suite. Everything runs just fine.

..except when, after installing our application, a client installs the Telerik WPF demos on his machine.
Then, for whatever reason, our application seems to load the Telerik binaries from the Telerik WPF demos,
NOT from the deployed application (license warning appears, theming is gone, ..).

Any idea why this happens?
The Telerik WPF demos do not install assemblies into the GAC, right?
(note that after uninstalling the Telerik WPF demos & re-installing our application, everything works just fine again)

Thanks for your time,
Koen
Dimitrina
Telerik team
 answered on 22 Nov 2013
2 answers
283 views
I work in an application that the user has the option to change the language of the application at any time. I need to be able to change the text of the filter menu(ex. "show rows with value that") to spanish or whatever other language we have available. We already have the power to make these translations I am just not sure how to grab the property of this text in order to change it. I know that the localization manager is how you would initially tell me how to fix this problem, however that approach is not optimal for our particular application. Is there any other way to grab that text properties and change its value other than using the localization manager? Any sort of work around? Any help would be appreciated.
Tyler
Top achievements
Rank 1
 answered on 22 Nov 2013
7 answers
228 views
Hi,

I want highlight one row on PivotGrid on mouse over.
In addtion, when user double click on that row, I want to execute some code.

Can anyone help me?
Rosen Vladimirov
Telerik team
 answered on 22 Nov 2013
2 answers
130 views
Suppose I have a the following class

public class DataRow
{
    public int X { get; set; }
    public int Y { get; set; }
 
    public bool Exclude;
}

I want to plot this on a RadChart using a seriesmapping, which I do like this.

ObservableCollection<DataRow> SeriesSource = new ObservableCollection<DataRow>();
SeriesMapping series = new SeriesMapping();
series.ItemsSource = source;
series.ItemMappings.Add(new ItemMapping("X", DataPointMember.XValue));
series.ItemMappings.Add(new ItemMapping("Y", DataPointMember.YValue));

Is there any way that I can include/exclude data points being plotted based on the value of 'Exclude'? I wish to be able to include/exclude certain points from the plotted line.

The only other solution I can think of is to scan through the collection and create a second collection just containing members which aren't excluded. This doesn't seem very efficient though.
Petar Marchev
Telerik team
 answered on 22 Nov 2013
4 answers
194 views
Hi,

I populated a treeview control dynamically with child nodes. In Win 7 this treeview has arrow marks for expand and collapse. I want to change it to traditional + and - symbols since our users are more comfortable with that. I have tried different themes but it didn't change this behavior.Please help.
Petar Mladenov
Telerik team
 answered on 22 Nov 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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?