Telerik Forums
UI for WPF Forum
1 answer
286 views

Hi

i am wpf programmer and use telerik grid view for showing database table.

i have a GridViewComboBoxColumn in my grid and the combobox items for each row is different.

how can i bind data for each row combo in run time?

Dilyan Traykov
Telerik team
 answered on 13 Nov 2015
1 answer
269 views

I want to get row value after i click a cell. I try using SelectionChanged and follow so many Q&A in many forum and still can't do this. maybe if you guys can give me an example for this, maybe after click a cell it will give message about every value in that row?

here is my whole code, i hope telerik team can help me.

XAML

<Grid>
        <StackPanel x:Name="xPanel">
            <telerik:RadGridView x:Name="dataGrid"
                                 AutoGenerateColumns="False"
                                 ColumnWidth="*"
                                 ShowGroupPanel ="False"
                                 CanUserReorderColumns ="False"
                                 ItemsSource="{Binding}"
                                 SelectionChanged="dataGrid_SelectionChanged">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="idx"
                                                DataMemberBinding="{Binding idx}" />
                    <telerik:GridViewDataColumn Header="tag"
                                                DataMemberBinding="{Binding tag}" />
                    <telerik:GridViewDataColumn Header="value"
                                                DataMemberBinding="{Binding value}" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
            <telerik:RadButton Content="Update" Height="30" Click="RadButton_Click" />
        </StackPanel>
    </Grid>

CS

namespace Setting
{
    public partial class MainWindow : Window
    {
        ScimoreDataAdapter dataAdp;
        DataSet ds;
 
        public MainWindow()
        {
            InitializeComponent();
 
            string dbInstanceName = "C:\\Users\\Abc\\Documents\\Visual Studio 2010\\Projects\\Setting\\Setting\\configdb";
            ScimoreEmbedded em = new ScimoreEmbedded();
            em.Open(dbInstanceName);
 
            try
            {
                using (ScimoreConnection cn = em.CreateConnection())
                {
                    cn.Open();
                    string query = "select idx,tag,value from config.info";
                    dataAdp = new ScimoreDataAdapter(query, cn);
                    DataTable dataTable = new DataTable("info");
                    ds = new System.Data.DataSet();
                    dataAdp.Fill(ds, "info");
                    dataGrid.ItemsSource = ds.Tables[0];
                    dataAdp.Update(ds, "info");
                }
            }
            catch (Exception)
            {
            }
        }
 
        private void RadButton_Click(object sender, RoutedEventArgs e)
        {
             
        }
 
        private void dataGrid_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            //System.Data.DataRowView CurrentSelected = ((System.Data.DataRowView)dataGrid.SelectedItem);
            //MessageBox.Show(Convert.ToString(CurrentSelected.Row.ItemArray[1]));
        }
    }
}

Dilyan Traykov
Telerik team
 answered on 13 Nov 2015
9 answers
197 views
I am loading a scanned PDF in the PDFViewer and if I navigate away from the page that is loading the pdf before the image of the pdf is finished rendering it causes the following exception: "The given key was not present in the dictionary"

I believe the exception comes from ImageLoader_WorkCompleted method from the Telerik.Windows.Documents.Fixed dll.
Tanya
Telerik team
 answered on 13 Nov 2015
0 answers
111 views
Hello,

I have downloaded and install a very beautiful Telerik winform application. I found a very nice tab control (We say probably radpageview to it in winforms) with a little close image aligned at right side. I am really impressed and want to create it in wpf. Telerik TabControl doesnot fullfill this behavior by default. I actually need to implement it dynamically when a user click on button. For example when a user click on button a tab control should be created dynamically as you can see in attached image.

I want to achieve this by using mvvm/xaml pattern using as much as simple example code. If you please send a sample project with complete code implementation i will be really glad and thankful.

 
Rauf
Top achievements
Rank 1
 asked on 12 Nov 2015
0 answers
126 views

Hello,

I have downloaded and install a very beautiful telerik winform application. I found a very nice tab control (We say probably radpageview to it in winforms) with a little close image aligned at right side. I am really impressed and want to create it in wpf. Telerik TabControl doesnot fullfill this behavior by default. I actually need to implement it dynamically when a user click on button. For example when a user click on button a tab control should be created dynamically as you can see in attached image.

I want to achieve this by using mvvm/xaml pattern using as much as simple example code. If you please send a sample project with complete code implementation i will be really glad and thankful.

 

Rauf
Top achievements
Rank 1
 asked on 12 Nov 2015
1 answer
113 views

Hi,

I'm seeing this "you are using unsupported command line flag --disable web security" error message in Chrome (Version 46.0.2490.86 m)​, which appears to be coming from Telerick's Test Studio plugins, as I don't see them when those are disabled.

Is there a way to get rid of that error message?

Thanks,

Arcady

Julia
Top achievements
Rank 1
 answered on 12 Nov 2015
3 answers
398 views
I've been playing with your Barcode Reader and assume I am doing something wrong or missing something. 

First, is there a way to "push the Open button" from the library?  When I produce a barcode image, I'd like to just have it read that when I ask in code... not from the button.

Secondly and more important, I can't get a good read.  I have created a demo app that I'd be happy to share.  I print a 128 barcode to PNG file.  Then, I attempt to read the value back using the reader and it never returns the value I entered into the barcode.

Output Barcode to PNG File:
SaveFileDialog dialog = new SaveFileDialog()
{
    DefaultExt = "png",
    Filter = "png (*.png)|*.png"
};
 
if (dialog.ShowDialog() == true)
{
    using (Stream stream = dialog.OpenFile())
    {
        Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(
            barCode,
            stream,
            new PngBitmapEncoder());
    }
}

Let me know if you want me to upload my demo app.
Joel
Joel Palmer
Top achievements
Rank 2
 answered on 12 Nov 2015
2 answers
162 views

I'm experiencing some odd behavior when changing the PropertySetMode at runtime. 

 

I have two object types: MyTestClass1 and MyTestClass2. MyTestClass1 has a writeable property IntProp and MyTestClass2 has a readonly property IntProp. If I start in Intersection mode with Item = List<Object> { myTestClass1Obj1, myTestClass1Obj2 } everything works properly. If I then change to PropertySetMode None with Item = myTestClass2Obj, the editor for IntProp will be writeable even though IntProp on myTestClass2Obj has no public setter.

 

See runnable test case below. I am running 2015.2.728

<Window x:Class="WpfApplication1.MainWindow"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       
        Title="MainWindow" Height="350" Width="525">
    <Grid>
    <StackPanel Orientation="Vertical">
      <Button Click="ButtonBase_OnClick">Change to mode none</Button>
      <telerik:RadPropertyGrid x:Name="rpg"/>
    </StackPanel>
  </Grid>
</Window>

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.ComponentModel.DataAnnotations;
using Telerik.Windows.Controls.Data.PropertyGrid;
 
namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
      private readonly MyTestClass test;
    private readonly MyTestClass test2;
    private readonly MyTestClass2 test3;
 
    public MainWindow()
        {
            InitializeComponent();
            rpg.AutoGeneratingPropertyDefinition += new EventHandler<Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs>(rpg_AutoGeneratingPropertyDefinition);
 
      // test data. IntProp is has a public setter
      test = new MyTestClass() { StringProp = "91das", RequiredField = "abc", IntProp = 10, DateTimeProp = new DateTime(1920, 2, 21) };
      test2 = new MyTestClass() { StringProp = "91das", RequiredField = "abc", IntProp = 10, DateTimeProp = new DateTime(1920, 2, 21) };
 
      // test data. IntProp is read only (no public setter)
      test3 = new MyTestClass2() { StringProp = "91das", RequiredField = "abc", DateTimeProp = new DateTime(1920, 2, 21) };
 
      rpg.Item = new List<Object> {test, test2};
      rpg.PropertySetMode = PropertySetOperation.Intersection;
        }
 
        void rpg_AutoGeneratingPropertyDefinition(object sender, Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs e)
        {
            (e.PropertyDefinition.Binding as Binding).ValidatesOnDataErrors = true;
            (e.PropertyDefinition.Binding as Binding).NotifyOnValidationError = true;
            (e.PropertyDefinition.Binding as Binding).ValidatesOnExceptions = true;
        }
 
        private ObservableCollection<ValidationError> results;
 
        public ObservableCollection<ValidationError> Results
        {
            get
            {
                if (this.results == null)
                {
                    this.results = new ObservableCollection<ValidationError>();
                }
                return results;
            }
        }
     
    private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
    {
      rpg.PropertySetMode = PropertySetOperation.None;
      rpg.Item = test3;
      // the property grid will now allow setting of test3.IntProp even though there is
      // no public setter
    }
  }
 
 
    public class MyTestClass : IDataErrorInfo, INotifyPropertyChanged
    {
         
        private int intVar;
        private string requiredField;
 
        public int IntProp
        {
            get { return intVar; }
            set
            {
                intVar = value;
                this.OnPropertyChanged("IntProp");
            }
        }
 
        [Required(ErrorMessage = "This field is Required.")]
        public string RequiredField
        {
            get { return requiredField; }
            set
            {
                requiredField = value;
                ValidateProperty("RequiredField", value);
                this.OnPropertyChanged("RequiredField");
            }
        }
 
        private string stringVar;
 
        public string StringProp
        {
            get { return stringVar; }
            set
            {
                stringVar = value;
                this.OnPropertyChanged("StringProp");
            }
        }
 
        private DateTime dateTimeVar;
 
        public DateTime DateTimeProp
        {
            get { return dateTimeVar; }
            set
            {
                dateTimeVar = value;
                this.OnPropertyChanged("DateTimeProp");
            }
        }
 
        [Browsable(false)]
        public string Error
        {
            get { return string.Empty; }
        }
 
        public string this[string columnName]
        {
            get
            {
                if (columnName == "IntProp")
                {
                    return this.IntProp < 100 && this.IntProp > 0 ? string.Empty : "Value should be in the range of (0, 100)";
                }
                if (columnName == "StringProp")
                {
                    return this.StringProp != null && Regex.IsMatch(this.StringProp, @"^[0-9]+[\p{L}]*") ? string.Empty : @"Value should math the regex: ^[0-9]+[\p{L}]*";
                }
                if (columnName == "DateTimeProp")
                {
                    return this.DateTimeProp.Year > 1900 ? string.Empty : "Date should be after 1/1/1900";
                }
                return string.Empty;
            }
        }
 
        protected void OnPropertyChanged(string name)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        public void ValidateProperty(string propName, object value)
        {
            var result = new List<System.ComponentModel.DataAnnotations.ValidationResult>();
            Validator.TryValidateProperty(value, new ValidationContext(this, null, null) { MemberName = propName }, result);
 
            if (result.Count > 0)
            {
               throw new ValidationException(result[0].ErrorMessage);
            }
        }
    }
 
 
  public class MyTestClass2 : IDataErrorInfo, INotifyPropertyChanged
  {
 
    private int intVar;
    private string requiredField;
 
    public int IntProp { get; } = 12;
 
    [Required(ErrorMessage = "This field is Required.")]
    public string RequiredField
    {
      get { return requiredField; }
      set
      {
        requiredField = value;
        ValidateProperty("RequiredField", value);
        this.OnPropertyChanged("RequiredField");
      }
    }
 
    private string stringVar;
 
    public string StringProp
    {
      get { return stringVar; }
      set
      {
        stringVar = value;
        this.OnPropertyChanged("StringProp");
      }
    }
 
    private DateTime dateTimeVar;
 
    public DateTime DateTimeProp
    {
      get { return dateTimeVar; }
      set
      {
        dateTimeVar = value;
        this.OnPropertyChanged("DateTimeProp");
      }
    }
 
    [Browsable(false)]
    public string Error
    {
      get { return string.Empty; }
    }
 
    public string this[string columnName]
    {
      get
      {
        if (columnName == "IntProp")
        {
          return this.IntProp < 100 && this.IntProp > 0 ? string.Empty : "Value should be in the range of (0, 100)";
        }
        if (columnName == "StringProp")
        {
          return this.StringProp != null && Regex.IsMatch(this.StringProp, @"^[0-9]+[\p{L}]*") ? string.Empty : @"Value should math the regex: ^[0-9]+[\p{L}]*";
        }
        if (columnName == "DateTimeProp")
        {
          return this.DateTimeProp.Year > 1900 ? string.Empty : "Date should be after 1/1/1900";
        }
        return string.Empty;
      }
    }
 
    protected void OnPropertyChanged(string name)
    {
      if (this.PropertyChanged != null)
      {
        this.PropertyChanged(this, new PropertyChangedEventArgs(name));
      }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    public void ValidateProperty(string propName, object value)
    {
      var result = new List<System.ComponentModel.DataAnnotations.ValidationResult>();
      Validator.TryValidateProperty(value, new ValidationContext(this, null, null) { MemberName = propName }, result);
 
      if (result.Count > 0)
      {
        throw new ValidationException(result[0].ErrorMessage);
      }
    }
  }
}
 

 

dafadsf

Chris
Top achievements
Rank 1
 answered on 12 Nov 2015
4 answers
237 views
With xaml
<Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="321*" />
            <ColumnDefinition Width="335*" />
        </Grid.ColumnDefinitions>
        <StackPanel>
            <Button Margin="5" GotFocus="GotFocus">Test</Button>
            <TextBox Margin="5" GotFocus="GotFocus">text</TextBox>
        </StackPanel>
        <telerik:RadPropertyGrid x:Name="pg" Grid.Column="1"
                                 LabelColumnWidth="100" IsGrouped="True" AutoGeneratePropertyDefinitions="True"
                                 telerik:StyleManager.Theme="Vista"/>
    </Grid>
and code

        private void GotFocus(object sender, RoutedEventArgs e)
        {
            pg.Item = sender;
        }
if you switch between controls than you see errors like this
System.Windows.Data Error: 40 : BindingExpression path error: 'ClickMode' property not found on 'object' ''TextBox' (Name='')'. BindingExpression:Path=ClickMode; DataItem='TextBox' (Name=''); target element is 'RadComboBox' (Name=''); target property is 'SelectedValue' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Command' property not found on 'object' ''TextBox' (Name='')'. BindingExpression:Path=Command; DataItem='TextBox' (Name=''); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'CommandParameter' property not found on 'object' ''TextBox' (Name='')'. BindingExpression:Path=CommandParameter; DataItem='TextBox' (Name=''); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'CommandTarget' property not found on 'object' ''TextBox' (Name='')'. BindingExpression:Path=CommandTarget; DataItem='TextBox' (Name=''); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')
Because the propertygrid do not clear bindings after change selected item.
The version is 2011.3.1330.40 Dev

Dilyan Traykov
Telerik team
 answered on 12 Nov 2015
4 answers
130 views
When I right-click outside the area containing the slots,for example, on the header, the context menu that I have defined still appears provided that I have a selected slot or appointment. Is it possible to constrain the context menu to the slot area?
Claire
Top achievements
Rank 1
 answered on 12 Nov 2015
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?