Telerik Forums
UI for WPF Forum
9 answers
430 views
Hello!

I'm new to WPF, but as life goes, I have to bind to a ObservableCollection of Business Objects to a RadGridView in Code Behind, because the number of GridViewDataColumns is dynamic. Here I have an example (in my real application, my business class contains fields for sales data and the radgridview should be able to show a different number of sales periods).

Example:
=======

Business Object:
----------------------
public class Person : INotifyPropertyChanged
{
    private string _Firstname;
    private string _Lastname;
    
    public evebt PropertyChangedEventHandler PropertyChanged;

    public string Firstname
    {
        get { return _Firstname; }
        set 
        {
            _Firstname = value;
            OnPropertyChanged("_Firstname");
        }
    }

    public string Lastname
     {
         get { return _Lastname; }
         set 
         {
             _Lastname = value;
             OnPropertyChanged("_Lastname");
         }
     }

    protected void OnPropertyChanged(string strPropName) 
     { 
         PropertyChangedEventHandler handler = PropertyChanged; 
         if (handler != null) 
         { 
             handler(this, new PropertyChangedEventArgs(strPropName)); 
         }     
     }
  
}

ObservableCollection:
-----------------------------

public class Persons : ObservableCollection<Person>
{
    public Persons() : base()
    {
    }
}

ExamplePage:
-------------------
public partial class ExamplePage:Page
{
    
    Persons _p;

    public ExamplePage()
    {
        InitializeComponent();
        //Pseudo-Code: the ObservableCollection ist filled up in the DAL
        _p = DAL.GetPersons();

        //How or what is the way of binding the ObservableCollection to the radgridview1??
        //Possibility 1:
        radgridview1.DataContext = _p;
        //Possibility 2:        
        radgridview1.ItemsSource= _p;
        //Possibility ...: anything else?

        GridViewDataColumn colFirstname = new GridViewDataColumn();
        colFirstname.Header = "Firstname";
        colFirstname.UniqueName = "cFirstname";
        
        //I think, that here is the right place for column-bindung, but how?

        radgridview1.Columns.Add(colFirstname);        

        GridViewDataColumn colFirstname = new GridViewDataColumn();
        colLastname.Header = "Lastname";
        colLastname.UniqueName = "cLastname";
 
        //I think, that here is the right place for column-bindung, but how?

        radgridview1.Columns.Add(colLastname);   

    }
}

Please help me!

Kind regards

Michael
Vlad
Telerik team
 answered on 22 May 2012
3 answers
146 views
Dear All,
Is there any way to change background brush (color or image) of an specific row in code behind (by row & cell number)?
Is there any way to got focus to an specific row (by row & cell number)?

Thanks
Vlad
Telerik team
 answered on 22 May 2012
2 answers
154 views
Hi,

I have two questions regarding ScheduleView Component

1. Is their a way to select all recurrence views associated to that appointment when any of its item is selected, i have attached a snapshot     to show how i require it when any one is selected
2. Is there a way to hide resize button (we dont want that feature)

Thanks
Moem
Top achievements
Rank 1
 answered on 21 May 2012
1 answer
110 views

key: WPF, RadRichTextBox, RadDocument

I did the following steps to print merged RadDocument but it does not print and calling Print method hangs on forever. I had to kill the process.  Printing 1 Document works fine but same issue happens when I try to print 2 merged documents.

1. I am merging a list of RadDocuments  in to one RadDocument using methods answered in this forum.       
2. Then setting RadRichTextBox’s  document to the above created merged RadDocument.
3. Then printing using RadRichTextBox’s print method. radRichTextBox.Print("richtextbox", PrintMode.Native)

FYI, for Part 1) I did try this:
    foreach(var document in radDocuments)
    {
        mergedDocument.CaretPosition.MoveToLastPositionInDocument();

        mergedDocument.InsertInline(new Telerik.Windows.Documents.Model.Span(FormattingSymbolLayoutBox.PAGE_BREAK));

        mergedDocument.InsertFragment(new DocumentFragment(document));

}

and also  this:
 RadDocument mergedDocument = new RadDocument();
 foreach (RadDocument document in documents)
 {
     foreach (Section section in document.Sections)     {
         Section copySection = section.CreateDeepCopy() as Section;
         document.Sections.Remove(section);
         mergedDocument.Sections.Add(copySection);
     }
 }

Am i merging RadDocuments correctly? What could be the issue?
If this is a known Issue, then whats the best way to Merge and Print RadDocuments?

By the way : Document 1 had 7 pages and Document had 4 pages with 4 images total. It seems that as soon as I merge it does not print.

Iva Toteva
Telerik team
 answered on 21 May 2012
1 answer
150 views

key: WPF, RadRichTextBox, RadDocument

I did the following steps to print merged RadDocument but it does not print and calling Print method hangs on forever. I had to kill the process.  Printing 1 Document works fine but same issue happens when I try to print 2 merged documents.

1. I am merging a list of RadDocuments  in to one RadDocument using methods answered in this forum.       
2. Then setting RadRichTextBox’s  document to the above created merged RadDocument.
3. Then printing using RadRichTextBox’s print method. radRichTextBox.Print("richtextbox", PrintMode.Native)

FYI, for Part 1) I did try this:
    foreach(var document in radDocuments)
    {
        mergedDocument.CaretPosition.MoveToLastPositionInDocument();

        mergedDocument.InsertInline(new Telerik.Windows.Documents.Model.Span(FormattingSymbolLayoutBox.PAGE_BREAK));

        mergedDocument.InsertFragment(new DocumentFragment(document));

}

and also  this:
 RadDocument mergedDocument = new RadDocument();
 foreach (RadDocument document in documents)
 {
     foreach (Section section in document.Sections)     {
         Section copySection = section.CreateDeepCopy() as Section;
         document.Sections.Remove(section);
         mergedDocument.Sections.Add(copySection);
     }
 }

Am i merging RadDocuments correctly? What could be the issue?
If this is a known Issue, then whats the best way to Merge and Print RadDocuments?

By the way : Document 1 had 7 pages and Document had 4 pages with 4 images total. It seems that as soon as I merge it does not print.

Thanks

Iva Toteva
Telerik team
 answered on 21 May 2012
4 answers
128 views
Hello!

I have many expression columns in my grid.

In the RowLoaded-Event I want th check, if the result of the expression is lower than 0. If yes, the text (forecast) color should be set to red.
How can I access the result of the expression?

private void gridview1(object sender, RowLoadedEventArgs e)
{
   var myExpressionCellList = e.Row.ChildrenOfType<GridViewCell>.Where(c => c.Column.UniqueName == "eAbwVjKgMon1").toList();
   foreach(GridViewCell cell in myExpressCellList)
   {
      cell. .... ?????
   }
}

I tried different things, but I'm not able to get the value for checking.

What I'm doing wrong? Please help.

Kind regards

Michael

Dimitrina
Telerik team
 answered on 21 May 2012
1 answer
217 views
Hi,

I'm using the latest version of Telerik and I want to know if it's possible to have the "WatermarkContent" the same opacity than the RadDatePicker???

Thank's
Boyan
Telerik team
 answered on 21 May 2012
1 answer
181 views
Hello everyone,

In my application, I need to retrieve the pdf document from the viewer in a memory stream, so I can save it into a table in the database.

Can someone please show couple lines of code to do this? (retrieving the pdf, and converting to a memory stream)

Thanks,
Kammen
Telerik team
 answered on 21 May 2012
0 answers
116 views
hi ,

         i am new to telerik controls...

i am interested in implementing header and footer in data pager... can any one suggest any thing.. how to implement header and footer in data pager...

--
V,sharath kumar
+91-9297057111
Sharath
Top achievements
Rank 1
 asked on 21 May 2012
3 answers
329 views
Hi,

how can i create a MenueItem with perhaps an expander, like you can see on the attached file? Or is there any "easy simple" example to create a own MenueItem Style?

Thanks
Rene
Yana
Telerik team
 answered on 21 May 2012
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
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?