Telerik Forums
UI for WPF Forum
0 answers
103 views
Hi,

I have a collection of simple objects ('Docks') that have a Name property which is a string. In a RadGridView I have a column defined as follows:

<telerik:GridViewComboBoxColumn Header="Dock"
                DisplayMemberPath="Name"
                SelectedValueMemberPath="Name"
                DataMemberBinding="{Binding DockName}"
                ItemsSource="{Binding Source={StaticResource LocatorKeeper}, Path=Locator.DocksDataViewModel.DocksCollection}" />

This correctly allows me to choose from entered Docks and assign it to a property of the element from the itemssource of the grid.

If I go back to the grid that is bound to the collection with Docks, I can update the name of a Dock. When I go back to the grid with the combobox column, I now correctly see the name updated in the combobox. However, the underlying object still has the old name saved. What I expect would happen is that the value is also written through the binding and stored in the DockName property of the object.

The current behavior is very misleading since the GUI shows the change to be propagated through the application whereas this is not actually the case.  I would like to know if there is a solution or a workaround for this issue.

Update (19-12-2011): after doing some further thinking it occurred to me that it is bad design to have your dependencies enforced by the presentation layer. The best solution is to simply store a reference to the object that contains the Name, so the type of  'DockName' should be changed from string to DockType and the SelectedValueMemberPath should be removed. After that it works as it should.

Of course, it remains the case the the behavior of the RadComboBox is misleading and it would be better to show a blank instead of the changed value.
Steven
Top achievements
Rank 1
 asked on 16 Dec 2011
1 answer
134 views
Dear Support!

I am using RadControls_for_WPF_2011_3_1205_DEV_hotfix.

When I am using RadGridView with VirtualQueryableCollectionView and I am pressing PageDown it's sometimes not working.
Every third keypress is not working (refer attachment).

Please let me know how to resolve the issue.

MainWindow.xaml
<Window x:Class="VirtualQueryableCollectionViewBugDemo.MainWindow"
        Title="MainWindow" Height="510" Width="700">
    <DockPanel>
        <TextBlock Width="250" Text="{Binding Log}" />
        <telerik:RadGridView ItemsSource="{Binding VirtualQueryableCollectionView}" EnableRowVirtualization="True" />
    </DockPanel>
</Window>


MainWindow.xaml.cs
namespace VirtualQueryableCollectionViewBugDemo
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
 
            this.DataContext = new MainViewModel();
        }
    }
}


MainViewModel.cs
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using Telerik.Windows.Data;
 
namespace VirtualQueryableCollectionViewBugDemo
{
    public class MainViewModel : INotifyPropertyChanged
    {
        public VirtualQueryableCollectionView VirtualQueryableCollectionView { get; set; }
        private ObservableCollection<Row> items { get; set; }
 
        public MainViewModel()
        {
            this.items = new ObservableCollection<Row>(Generator.GenerateTestData());
             
            this.VirtualQueryableCollectionView = new VirtualQueryableCollectionView(this.items);
            this.VirtualQueryableCollectionView.LoadSize = 20;
            this.VirtualQueryableCollectionView.ItemsLoading += (s, e) =>
            {
                AppendLog(string.Format("Load StartIndex={0} ItemsCount={1}", e.StartIndex, e.ItemCount));
                this.VirtualQueryableCollectionView.Load(e.StartIndex,
                    this.items.Cast<Row>().Skip(e.StartIndex).Take(e.ItemCount));
            };
        }
 
        private string log;
        public string Log
        {
            get { return this.log; }
            set
            {
                this.log = value;
                RaisePropertyChanged("Log");
            }
        }
        public void AppendLog(string message)
        {
            this.Log = message + Environment.NewLine + this.Log;
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
        private void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}


Model.cs
using System;
using System.Collections.Generic;
 
namespace VirtualQueryableCollectionViewBugDemo
{
    public class Row
    {
        public int Id { get; set; }
        public DateTime DateTime { get; set; }
        public TimeSpan TimeSpan { get; set; }
    }
 
    public static class Generator
    {
        public static int TestDataLength = 1 * 1000 * 1000;
        public static Random rng = new Random();
 
        public static List<Row> GenerateTestData()
        {
            var result = new List<Row>(TestDataLength);
 
            for (int i = 0; i < TestDataLength; i++)
            {
                string name = i.ToString();
                DateTime dateTime = new DateTime(rng.Next(1990, 2020), rng.Next(1, 12), rng.Next(1, 28));
                TimeSpan timeSpan = new TimeSpan(rng.Next(1, 23), rng.Next(1, 59), rng.Next(1, 59));
 
                result.Add(new Row()
                {
                    Id = i,
                    DateTime = dateTime,
                    TimeSpan = timeSpan
                });
            }
 
            return result;
        }
    }
}
Vera
Telerik team
 answered on 16 Dec 2011
0 answers
375 views
I want to validate my RadGridView manually by pressing a button, but I cant' get this to work. If I set the validator to ValidatesOnTargetUpdated="True" the validation works, but I want to trigger this validaton manually. Here is the XAML code of my DataColumn:

<telerik:GridViewDataColumn Header="Error" >
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <telerik:GridViewCell>
                <telerik:GridViewCell.DataContext>
                    <Binding NotifyOnValidationError="True" >
                        <Binding.ValidationRules>
                            <validators:MyValidator  />
                        </Binding.ValidationRules>
                    </Binding>
                </telerik:GridViewCell.DataContext>
                <telerik:GridViewCell.Style>
                    <Style TargetType="{x:Type telerik:GridViewCell}" >
                        <Style.Triggers>
                            <Trigger Property="Validation.HasError" Value="true">
                                <Setter Property="ToolTip"
                                    Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                                    Path=(Validation.Errors)[0].ErrorContent}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </telerik:GridViewCell.Style>
                <telerik:GridViewCell.Content>
                    <TextBlock Text="!!!" />
                </telerik:GridViewCell.Content>
            </telerik:GridViewCell>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

I' ve managed to get the validator in codebehind and check every item in the datagrid, but I also have to set the bindings as invalid for the cells to display the error. I found the command System.Windows.Controls.Validation.MarkInvalid() for this, but for this command to work I need to get the binding expression of every cell. How can I get these binding expressions?
Davidm
Top achievements
Rank 1
 asked on 16 Dec 2011
3 answers
1.1K+ views
Hello,

I wanted to know how can I make the slider thumb to jump to the position where I click on the slider. In other words, how can I retrieve the value where the user clicked on the slider (and then I could set the slider's value).

Thank you
Petar Mladenov
Telerik team
 answered on 16 Dec 2011
1 answer
138 views
Dear Support,

i templated the DropDownContent like this,

<DataTemplate x:Key="outlookBaItemDropDownContentTemplate">
    <StackPanel Orientation="Horizontal">
        <Image Source="{Binding SmallIcon}"
               Width="20" />
        <Label Content="{Binding Header}" />
    </StackPanel>
</DataTemplate>


however the dropdown was originally intendet to use two columns, -
one for the icon, one for the header.

How can I make the items fit anyway?


Thanks in advance Martin
Petar Mladenov
Telerik team
 answered on 16 Dec 2011
1 answer
300 views
Dear Support!

I am using RadControls_for_WPF_2011_3_1205_DEV_hotfix.

When I set RadBusyIndicator.IsBusy="True" and operating system is running a cpu hungry process, I can click on the RadBusyIndicator content before RadBusyIndicator show busy content (refer attachment).

Please let me know how to resolve the issue.

MainWindow.xaml
<Window x:Class="RadBusyIndicatorDemo.MainWindow"
        Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen">
     
    <StackPanel>
        <TextBlock x:Name="textBlock" />
        <telerik:RadBusyIndicator IsBusy="True">
            <StackPanel>
                <Button Content="Button1" Click="Button_Click"/>
                <telerik:RadGridView ItemsSource="{Binding Items}" Height="300" />
            </StackPanel>
        </telerik:RadBusyIndicator>
    </StackPanel>
</Window>


MainWindow.xaml.cs
namespace RadBusyIndicatorDemo
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
 
            this.DataContext = new MainViewModel();
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.textBlock.Text = "clicked!"; // shouldn't happen
        }
    }
}
Ivo
Telerik team
 answered on 16 Dec 2011
5 answers
120 views
Hello Telerik,
I've got a RadGridView that has some columns... when I scroll down the grid and there's a column content that doesn't fit the column width it enlarges the column to content's size... if I'm not wrong there is a property for setting not to enlarge... but I can't find it, can you please help me?

Thanks
Vlad
Telerik team
 answered on 16 Dec 2011
1 answer
126 views
Hello,

I have a treelistview.  When user right click on an item and applies filter then I add one FilterDescriptor to the treelistview.
But it tries to filter on all the rows. My requirement is when user right click on any item then the filter should be applied only to the expanded nodes, not to those are collapsed nodes.

I have treelistview having upto 7 levels of expanded nodes. What i want is when user applies filter descriptor then it should filter all the data whose first level is expanded

Level 1 Level 2 Level 3 Level 4 Level 5 Level 6 Level 7
(-) Org
Dept 1
Cell 1
Mgr 1
Lead 1
Resp 1
Work1
Work2
Work3
Resp 2
Work4
Work5
Work6
(+) Dept 2
(+) Dept 3
(-) Dept4
Cell 4
Mgr 4
Lead 4
Resp 4
Work1
Work2
Work3
Resp 5
Work4
Work5
Work6
Dept 2 & Dept 3 are not in expanded state. While I filter I want the filter should be applied to those records of Dept 1 (Resp1, Resp2) & Dept 4 (Resp4 & Resp5)only
User can right click on Level 7 data only
Vlad
Telerik team
 answered on 16 Dec 2011
1 answer
143 views
We develop using the mvvm-pattern. While the VirtualQueryableCollectionView can be easily created in the code-behind, I would prefer to create it as a StaticResource in the View, as it is View-specific and doesn't belong in the ViewModel.

How would I create it as a resource? I would have liked to write something like:

 

<UserControl.Resources>
    <telerik:VirtualQueryableCollectionView x:Key="VirtualizedTransactions" 
        LoadSize
="10" 
        
ItemsSource="{Binding AllTransactions}" 
    />
</UserControl.Resources>

 


Any thoughts are appreciated.
Vlad
Telerik team
 answered on 16 Dec 2011
3 answers
100 views
Hi,

I have a horizontal bar RadChart. I bind to one list of objects, so I have one series. I do not show a legend - basically I show text for the Name of the bound object at each data point, and the size of the bar is the Value. I have a third property which I would like to bind to the color of the bar. I haven't found how to do this in the documentation that I've found. Any ideas?

Here's the XAML:
<telerikChart:RadChart VerticalAlignment="Top" UseDefaultLayout="False"  MaxHeight="180" ItemsSource="{Binding CurrentShiftScrap, Converter={StaticResource emptyConverter}}">
   <Grid>
      <telerikCharting:ChartArea x:Name="mainScrapArea" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" PaletteBrushesRepeat="False" EnableAnimations="False">
         <telerikCharting:ChartArea.AxisX>
            <telerikCharting:AxisX MajorTicksVisibility="Collapsed" MinorTicksVisibility="Collapsed">
               <telerikCharting:AxisX.AxisStyles>
                  <telerikCharting:AxisStyles ItemLabelStyle="{StaticResource RightJustifyChartLabelStyle}"/>
               </telerikCharting:AxisX.AxisStyles>
            </telerikCharting:AxisX>
         </telerikCharting:ChartArea.AxisX>
         <telerikCharting:ChartArea.AxisY>
            <telerikCharting:AxisY StripLinesVisibility="Collapsed" MajorTicksVisibility="Collapsed" MinorTicksVisibility="Collapsed" AxisLabelsVisibility="Collapsed"/>
         </telerikCharting:ChartArea.AxisY>
         <telerikCharting:ChartArea.PaletteBrushes>
            <SolidColorBrush Color="#FF1199CC"/>
         </telerikCharting:ChartArea.PaletteBrushes>
      </telerikCharting:ChartArea>
   </Grid>
   <telerikChart:RadChart.SeriesMappings>
      <telerikCharting:SeriesMapping ChartAreaName="mainScrapArea">
         <telerikCharting:SeriesMapping.SeriesDefinition>
            <telerikCharting:HorizontalBarSeriesDefinition ShowItemToolTips="True" ShowItemLabels="False" LegendDisplayMode="DataPointLabel" ItemToolTipFormat="#DATAITEM.Name: #DATAITEM.Value' Scrap"/>
         </telerikCharting:SeriesMapping.SeriesDefinition>
         <telerikCharting:SeriesMapping.ItemMappings>
            <telerikCharting:ItemMapping DataPointMember="XCategory" FieldName="Name"/>
            <telerikCharting:ItemMapping DataPointMember="YValue" FieldName="Value"/>
         </telerikCharting:SeriesMapping.ItemMappings>
      </telerikCharting:SeriesMapping>
   </telerikChart:RadChart.SeriesMappings>
</telerikChart:RadChart>

In a perfect world, I would map (in the ItemMapping) some DataPointMember to the color of the bar, referencing the FieldName from my bound object, and a value converter to turn the property into a fill color.

Any help would be greatly appreciated.

-Dan Pingel
Petar Marchev
Telerik team
 answered on 16 Dec 2011
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?