Telerik Forums
UI for WPF Forum
5 answers
385 views
I've been stumbling all over this all day and need some direction.  I've paired down my code and am posting it in hopes that someone can tell me what I'm doing wrong.
The xaml...
<telerik:RadGridView AutoGenerateColumns="False"
                        ItemsSource="{Binding Screens}">
    <telerik:RadGridView.Columns>
        <telerik:GridViewComboBoxColumn x:Name="ScreenTypeCombo"
                                        UniqueName="ScreenTypeCombo"
                                        Header="Screen Type"
                                        Width="150"
                                        DataMemberBinding="{Binding SelectedScreenType}"
                                        SelectedValueMemberPath="ScreenType"
                                        DisplayMemberPath="Literal"
                                        ItemsSourceBinding="{Binding ScreenTypeLiterals}" />
    </telerik:RadGridView.Columns>


The ViewModel...

public enum ScreenTypes
{
    Master,
    Vertical,
    Multicolumn,
    Wrap,
    Detail,
    Transaction,
    Notes
}
 
public class ScreenTypeLiteral
{
    public ScreenTypes ScreenType
    {
        get;
        set;
    }
 
    public String Literal
    {
        get;
        set;
    }
 
    public ScreenTypeLiteral(ScreenTypes type, String lit)
    {
        ScreenType = type;
        Literal = lit;
    }
}
 
public class ScreenDescriptor
{
    public ICollectionView ScreenTypeLiterals
    {
        get
        {
            return _ScreenTypeLiterals;
        }
        set
        {
            _ScreenTypeLiterals = value;
            OnPropertyChanged(() => ScreenTypeLiterals);
        }
    }
    private ICollectionView _ScreenTypeLiterals;
 
    public ScreenTypeLiteral SelectedScreenType
    {
        get
        {
            return ScreenTypeLiterals.CurrentItem as ScreenTypeLiteral;
        }
    }
 
    public ScreenDescriptor()
    {
        ScreenTypeLiterals = CollectionViewSource.GetDefaultView(new List<ScreenTypeLiteral>()
        {
            {new ScreenTypeLiteral(ScreenTypes.Master, "Master View")},
            {new ScreenTypeLiteral(ScreenTypes.Vertical, "Detail View")},
        });
        ScreenTypeLiterals.MoveCurrentToFirst();
    }
 
}
 
public class Descriptor
{
    public ICollectionView Screens
    {
        get
        {
            return _screens;
        }
        set
        {
            _screens = value;
            OnPropertyChanged(() => Screens);
        }
    }
    private ICollectionView _screens = null;
 
    public Descriptor()
    {
        var list = new List<ScreenDescriptor>();
        list.Add(new ScreenDescriptor());
        list.Add(new ScreenDescriptor());
 
        Screens = CollectionViewSource.GetDefaultView(list);
        Screens.MoveCurrentToFirst();
    }
 
}


Thanks in advance,
Steve
Dimitrina
Telerik team
 answered on 26 Mar 2013
7 answers
241 views
I don't know if I'm missing something obvious, but if anyone has any ideas I'd be grateful.  Feel like I'm banging my head against a wall!

My requirement is that I need a column with all the usual stuff that GridViewDataColumn usually gives you - display, edit, filter, sort, group etc.  But I can't work out how to get a DataMemberBinding value that will do what I want.

It probably makes the most sense if I explain the actual problem rather than trying to make one up, as it's fairly easy to understand.

I have 3 'fixed' columns:

Description (text)
Value (decimal)
Adjusted Value (decimal)

I then have 0->n 'Adjustment' (decimal) columns that get dynamically added in between Value and Adjusted Value.  So the idea is that the Value + all Adjustment values = Adjusted Value

So, the value I need to bind to is a decimal, but it requires a method to access it (e.g. 'GetValueForAdjustment(Adjustment adjustment)') and a method to set it (e.g. 'SetValueForAdjustment(Adjustment adjustment, decimal value)'). 

Now I could probably set DataMemberBinding to use a ValueConverter which will get me the value, sorting, grouping etc.  But I'm not going to be able to edit it. 

MultiBinding is the other option, but DataMemberBinding doesn't support MultiBinding.

Anything glaring that I'm missing?

Nedyalko Nikolov
Telerik team
 answered on 26 Mar 2013
1 answer
193 views
I have a Line Chart with two series, the problem is one of my series has two data points with Category values that do not exist in the first series. When I create each of these series using GenericDataPointBinding expressions, the 2nd series renders "off" because the two Category values get tacked on out of order at the end of the graph instead of being inserted in order (see this image).

Is there a way to prevent this outside of forcing each series to have exactly the same Categories?
Peshito
Telerik team
 answered on 26 Mar 2013
0 answers
121 views

Dear Telerik Team!

I'm handling SchedulerView's VisibleRangeChange event:

private ICommand visibleRangeChanged;
public ICommand VisibleRangeChanged
{
            get
            {
                return this.visibleRangeChanged;
            }
            set
            {
                this.visibleRangeChanged = value;
            }
}
 
private void OnVisibleRangeExecuted(object param)
{
//my code here
}
 
public bool OnVisibleRangeCanExecute(object param)
{
 return param != null;
 
}

but in some cases, I would like to disable event execution, change some active view definition properties and attach back to the event. Is is possible and if so - could you please tell me how to do it?

Very best regards and thank you in advance
Krzysztof

Krzysztof
Top achievements
Rank 1
 asked on 26 Mar 2013
1 answer
195 views
I am getting some empty space around the child of a row. I think it is due to the value set for padding for a border in the SelectiveScrolling grid in the visual tree of the gridview. What is the easy way to remove this padding. I find a similar post  for winforms gridview here http://www.telerik.com/community/forums/winforms/gridview/hierarchy-child-size.aspx#2550183
Dimitrina
Telerik team
 answered on 26 Mar 2013
3 answers
207 views
hi,
i have multiple y-axis in my graph......and i want to bold a single plot when mouse hovers over it and fade rest plots on the graphs.
i am not getting solution in telerik chart view.
can u help me vid it?
Petar Marchev
Telerik team
 answered on 26 Mar 2013
1 answer
131 views
I have a large amount of data I want to visualize that comes from an analysis sampling machine.  I have a data point every 3 seconds for a total of about 5000 data points.  I want to be able to use the timebar to make a selection that I can show in more detail in a radcartesianchart.  I can't seem to figure out how to setup Time bar to show the data at all no less be able to make a selection to show in the secondary chart.

Can you please lend some guidance on this?  I can't find any other sliding selection tool that would seem to work for this sort of data.
Tsvetie
Telerik team
 answered on 26 Mar 2013
1 answer
239 views
Hi, please tell me how to set 24h time format, and how to modify the IntervalSpans collection in the program code. As I understand it in the Q1 2013 release (version 2013.1.0220) this is possible.
Missing User
 answered on 26 Mar 2013
7 answers
1.5K+ views
I've made a small example which illustrates my problem:

MainWindow.xaml:
<Window x:Class="TestListView.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        Title="MainWindow" Height="350" Width="525"
        DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <Window.Resources>
        <ResourceDictionary>
            <Style TargetType="ScrollViewer">
                <Setter Property="telerik:StyleManager.Theme"  Value="Windows7" />
                <Setter Property="VerticalScrollBarVisibility"  Value="Auto" />
                <Setter Property="HorizontalScrollBarVisibility"  Value="Auto" />
            </Style>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <ListView Grid.Row="0" Grid.Column="0" x:Name="_lwReminders" Margin="1" Background="WhiteSmoke" ItemsSource="{Binding TheList}"
                      HorizontalAlignment="Stretch" SelectionMode="Single"                    
                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                        ScrollViewer.VerticalScrollBarVisibility="Auto"
                      ScrollViewer.CanContentScroll="False"
                      HorizontalContentAlignment="Stretch"
                      VerticalContentAlignment="Stretch"
                      VirtualizingStackPanel.IsVirtualizing="True"
                       VirtualizingStackPanel.VirtualizationMode="Recycling">
            <ListView.ItemContainerStyle>
                <Style TargetType="{x:Type ListViewItem}">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    <Setter Property="Focusable" Value="false"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <TextBox Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch"
                            VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Left"
                            Text="{Binding Description}" Margin="5" AcceptsReturn="True" AcceptsTab="True"  />
                            <!--Style="{StaticResource TextBoxInputStyle}" />-->


                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</Window>

MainWindow.xaml.cs:
public partial class MainWindow : Window
    {
        public class Animal
        {
            public string Name { get; set; }
            public string Description { get; set; }
        }
        public MainWindow()
        {
            InitializeComponent();
            TheList.Add(new Animal{Description = "Elephants are large mammals of the family Elephantidae and the order Proboscidea. Traditionally, two species are recognised, the African elephant (Loxodonta africana) and the Asian elephant (Elephas maximus), although some evidence suggests that African bush elephants and African forest elephants are separate species (L. africana and L. cyclotis respectively). Elephants are scattered throughout sub-Saharan Africa, and South and Southeast Asia. They are the only surviving proboscideans; extinct species include mammoths and mastodons. The largest living terrestrial animals, male African elephants can reach a height of 4 m (13 ft) and weigh 7,000 kg (15,000 lb). These animals have several distinctive features, including a long proboscis or trunk used for many purposes, particularly for grasping objects. Their incisors grow into tusks, which serve as tools for moving objects and digging and as weapons for fighting. The elephant's large ear flaps help to control the temperature of its body. African elephants have larger ears and concave backs while Asian elephants have smaller ears and convex or level backs."});
            TheList.Add(new Animal{Description = "The giraffe (Giraffa camelopardalis) is an African even-toed ungulate mammal, the tallest living terrestrial animal and the largest ruminant. Its species name refers to its camel-like appearance and the patches of color on its fur. Its chief distinguishing characteristics are its extremely long neck and legs, its horn-like ossicones and its distinctive coat patterns. It stands 5–6 m (16–20 ft) tall and has an average weight of 1,600 kg (3,500 lb) for males and 830 kg (1,800 lb) for females. It is classified under the family Giraffidae, along with its closest extant relative, the okapi. The nine subspecies are distinguished by their coat patterns."});
            TheList.Add(new Animal { Description = "The lion (Panthera leo) is one of the four big cats in the genus Panthera and a member of the family Felidae. With some males exceeding 250 kg (550 lb) in weight,[4] it is the second-largest living cat after the tiger. Wild lions currently exist in sub-Saharan Africa and in Asia (where an endangered remnant population resides in Gir Forest National Park in India) while other types of lions have disappeared from North Africa and Southwest Asia in historic times. Until the late Pleistocene, about 10,000 years ago, the lion was the most widespread large land mammal after humans. They were found in most of Africa, across Eurasia from western Europe to India, and in the Americas from the Yukon to Peru.[5] The lion is a vulnerable species, having seen a major population decline of 30–50% over the past two decades[date missing] in its African range.[2] Lion populations are untenable outside designated reserves and national parks. Although the cause of the decline is not fully understood, habitat loss and conflicts with humans are currently the greatest causes of concern. Within Africa, the West African lion population is particularly endangered." });
        }


        private readonly List<Animal> _theList = new List<Animal>();
        public List<Animal> TheList
        {
            get { return _theList; }
        }
    }


The solution attached contains a style on Scrollviewer, which sets the theme, verticalscrollbarvisibility and horizontalscrollbarvisibility.

If I remove the 3 setters from the style, then the example does what I want it to (see jpg-file example A, textbox uses wrap), but when the 3 setters are in the style it kind of destroys the way it is supposed to work (see jpg-file example B, textbox does not use wrap).

How do I get my small application to use the 3 setters while behaving like in example A ?

Thanks
Inger Marie
Top achievements
Rank 1
 answered on 26 Mar 2013
11 answers
702 views
I'm using RadPropertyGrid to display multiple groups of properties & need to know how to: Control the Display Order of the Groups.

I define the PropertyDefinitions in the order in which I want them in in XAML, but the groups don't display in either alphabetical or
the order I define them.

How can I fix this in XAML or code-behind?

Alan
Maya
Telerik team
 answered on 26 Mar 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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?