Telerik Forums
UI for WPF Forum
1 answer
1.4K+ views

Hello, i have no idea how to get the checked/unchecked event in mvvm. My goal is that i wan't do do some cell item calculation when rows are selected/deselected.

Here is my code:

<telerik:GridViewDataColumn DataMemberBinding="{Binding IsActive}" Header="" HeaderCellStyle="{StaticResource HeaderCellStyleGrid1}" ColumnGroupName="GruppenBezeichnung" Width="25">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                                <CheckBox IsChecked="{Binding IsActive, Mode=TwoWay}">
                                    <telerik:EventToCommandBehavior.EventBindings>
                                        <telerik:EventBinding Command="{Binding OnGridSelectionChangedCommand}" EventName="Checked" PassEventArgsToCommand="True" />
                                    </telerik:EventToCommandBehavior.EventBindings>
                                </CheckBox>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>

 

There is also a CheckboxColumn. Would this be a better approach and how get the checked/unchecked event?

<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsActive, Mode=TwoWay}" Header="" AutoSelectOnEdit="True" EditTriggers="CellClick" HeaderCellStyle="{StaticResource HeaderCellStyleGrid1}" ColumnGroupName="GruppenBezeichnung" Width="25"/>

 

Thank you and please can you show me a example.

Greetings RG

Martin Ivanov
Telerik team
 answered on 27 Jun 2018
1 answer
312 views
Following your "https://docs.telerik.com/devtools/wpf/controls/radgridview/getting-started/getting-started2#adding-radgridview-to-the-project" document but can't build the example. Trying to follow document to test programmatically filtering.
When I follow the examples I'm getting these messages in VS2017:
Severity Code Description Project File Line Suppression State
Error  gridView is not supported in a Windows Presentation Foundation (WPF) project. ProgrammaticFiltering F:\How-to and Research\C#\Telerik RadGridView\ProgrammaticFiltering\ProgrammaticFiltering\MainWindow.xaml 11
Error  The type 'local:gridView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. ProgrammaticFiltering F:\How-to and Research\C#\Telerik RadGridView\ProgrammaticFiltering\ProgrammaticFiltering\MainWindow.xaml 11
Error  The namespace prefix "local" is not defined. ProgrammaticFiltering F:\How-to and Research\C#\Telerik RadGridView\ProgrammaticFiltering\ProgrammaticFiltering\MainWindow.xaml 11
Error  The namespace prefix "local" is not defined. ProgrammaticFiltering F:\How-to and Research\C#\Telerik RadGridView\ProgrammaticFiltering\ProgrammaticFiltering\MainWindow.xaml 11

Martin Ivanov
Telerik team
 answered on 27 Jun 2018
1 answer
125 views

Hallo Telerik , 

i think there is an issue but i am not sure. 

1) i using the RadGridView + QueryableCollectionView as ItemSource 

2) I prepared the Collection i think correctly and Data is shown in the Grid also the paging prev and next works as "expected". 

   Debuging show me that the Property of SelectedUiDataItem ( see part of code below ) is called twice.

   First with Value = NULL and second with a Value != NULL which is the new Item set on the new Page. So i think a normal Condition.

Problem comes after Record is changed ! 

If i start changeing a Record in the Grid and Ending the Change with Return or selecting a different Record. 

On Return (i stay in same record in grid) the SelectedUiDataItem is called several times ( counted 22 ) 

1) Time called with value = null 

2-21) Times called for each Record in the Page 

22) Time called with value = null 

How can this been avoided what have i done wrong because in the SelectedItem Property i do not know which is the "real" current item ( = null) at the End and Updates are failing.

thanks br thomas cinatl

 

<telerik:RadGridView x:Name="LookupListGridCtrl" ItemsSource="{Binding Nodes, Mode=TwoWay}" SelectedItem="{Binding SelectedUiDataItem,Mode=TwoWay}"  Grid.Row="1" 
                             AutoGenerateColumns="false" NewRowPosition="Top" SelectionMode="Single" SelectionUnit="FullRow" 
                             CanUserDeleteRows="True" IsSynchronizedWithCurrentItem="True" CanUserResizeColumns="True" CanUserSearch="True"
                             RowIndicatorVisibility="Visible" Margin="0,0,0,1" ValidationType="Default" 
                             FilteringMode="FilterRow" 
		>

 

           <telerik:EventToCommandBehavior.EventBindings>
                <telerik:EventBinding Command="{Binding CommandProvider.DoDeleteRow}" EventName="Deleted" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoUpdateRow}" EventName="RowEditEnded" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoAddNew}" EventName="AddingNewDataItem" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoValidatingCell}" EventName="CellValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName="RowValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoSelectionChanging}" EventName="SelectionChanging" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
            </telerik:EventToCommandBehavior.EventBindings>

.....

</telerik:RadGridView>
 
        <telerik:RadDataPager PageSize="20"
                          Grid.Row="2" FontSize="12" Margin="0,-1,0,0" 
                          Source="{Binding Items, ElementName=LookupListGridCtrl}"
                          IsTotalItemCountFixed="True"
                          DisplayMode="FirstLastPreviousNextNumeric, Text" />

Martin Ivanov
Telerik team
 answered on 27 Jun 2018
1 answer
574 views

Hi,

base 64 encode images in html source file are not shown in RadRichTextBox after being imported via HtmlFormatProvider.Import (string). Do I miss a thing or made a mistake?

A sample solution is attached (the generated.html shows the expexted result)

 

Thanks in advance

Best regards  Joachim

Polya
Telerik team
 answered on 27 Jun 2018
15 answers
269 views
WPF:

Hi Team, I have a problem that some rows are missing while pasting to excel,

copy by Ctrl+A and
paste by Ctrl+V from Telerik RadGridView to MS Excel

RadGrid Attributes:
SelectionMode="Extended"
SelectionUnit="Cell"
ClipboardPasteMode="Cells,OverwriteWithEmptyValues"  
ClipboardCopyMode="All,Header"
Martin Ivanov
Telerik team
 answered on 26 Jun 2018
1 answer
125 views

hi all

I convert my project from windows form to wpf

and I use this code in the windows form

 

radGridViewCostList.Rows.Clear();    

       foreach (var cost in _costList)      

     {             

  var newRow = radGridViewCostList.Rows.NewRow();         

      newRow.Cells["cost"].Value = cost.Name;       

        newRow.Cells["id"].Value = cost.ID;         

                    newRow.Cells["description"].Value = cost.Description;  

             newRow.Cells["proposedValue"].Value = cost.ProposedValue;      

 

              radGridViewCostList.Rows.Add(newRow);    

       }

 

in wpf  radgrid dose not have Row Property

I use this code bot can not find GridViewCell

 

uxRadGridView_CostTypeList.BeginInsert();

var newRow = uxRadGridView_CostTypeList.ChildrenOfType<GridViewNewRow>();   

      if (newRow == null) {     return; }  

        var cells = new.RowFirstOrDefault().ChildrenOfType<GridViewCell>();

var costCell_ID = newRow.FirstOrDefault().ChildrenOfType<GridViewCell>().Where(c => c.Name.ToString() == uxGridViewColumn_id.Name).First(); costCell_ID.Content =" cost.ID";

 

xaml code :

<telerik:RadGridView x:Name="uxRadGridView_CostTypeList" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsReadOnly="True" AutoGenerateColumns="False" ShowGroupPanel="False" NewRowPosition="Top">                     <telerik:RadGridView.Columns>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_row" UniqueName="row" Header="ردیف" Width="45" MaxWidth="45" MinWidth="35"/>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_id" UniqueName="id" Header="کد" MaxWidth="90" MinWidth="50" Width="76"/>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_cost" UniqueName="cost" Header="نام هزینه" MaxWidth="300" MinWidth="150" Width="227"/>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_category" UniqueName="category" Header="گروه" MaxWidth="100" Width="151"/>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_proposedValue" UniqueName="proposedValue" Header="قیمت پیش فرض" MaxWidth="110" MinWidth="110" Width="110"/>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_Accounting" UniqueName="Accounting" Header="سرفصل مرتبط" MinWidth="80" Width="153"/>                 <telerik:GridViewColumn x:Name="uxGridViewColumn_description" UniqueName="description" Header="توضیحات" MinWidth="150" Width="299"/>             </telerik:RadGridView.Columns>                 </telerik:RadGridView>

Martin Ivanov
Telerik team
 answered on 26 Jun 2018
1 answer
83 views

I am assigning my grid a context menu.  However, I only want the context menu on the contents of the grid, not on the column nor row headers.  How would I do that?

In case you care, I'm doing this in code using the following:

myGrid.ContextMenuOpening += MyGrid_ContextMenuOpening;
myGrid.ContextMenu = gridCM 
Dinko | Tech Support Engineer
Telerik team
 answered on 26 Jun 2018
9 answers
5.6K+ views

I have a couple of buttons embedded in a header column of my radgridview that is in a usercontrol that is in a pane of a raddock. I am trying to bind the IsVisible property of the button to a property of my MainWindows' view model. Below is the relevant xaml. See line 7 of the xaml. I can't seem to get the binding right. What's the right way to bind this property to the MainWindow's viewmodel property? Obviously, I'm not seeing it.

Any help would be great!!!

Here is the error I get in my command window of vstudio.:

     System.Windows.Data Error: 4 : Cannot find source for binding with reference      'RelativeSource FindAncestor, AncestorType='System.Windows.Window',      AncestorLevel='1''. BindingExpression:Path=DataContext.EnableRowDetailsButton;      DataItem=null; target element is 'Button' (Name='cmdAddNewSample'); target property is     'IsEnabled' (type 'Boolean')

 

01.<telerik:GridViewDataColumn Width="auto" >
02.    <telerik:GridViewDataColumn.Header>
03. 
04.        <StackPanel Orientation="Horizontal">
05.            <Button Content="Add New" x:Name="cmdAddNewSample"
06.                Click="cmdAddNewSample_Click" Tag="AddOrUploadButton"
07.                IsEnabled="{Binding DataContext.EnableRowDetailsButton,
08.                                RelativeSource={RelativeSource FindAncestor,
09.                                                AncestorType={x:Type Window}}}"
10.                Margin="0,5,5,5"/>
11.            <Button Content="Upload" x:Name="cmdUploadSample" Tag="AddOrUploadButton"
12.                IsEnabled="{Binding DataContext.EnableRowDetailsButton,
13.                                RelativeSource={RelativeSource FindAncestor,
14.                                                AncestorType={x:Type Window}}}"
15.            Command="{Binding DataContext.UploadSampleCommand, Mode=TwoWay,
16.                                RelativeSource={RelativeSource FindAncestor,
17.                                                AncestorType={x:Type UserControl}}}"
18.                Margin="0,5,0,5"/>
19.        </StackPanel>
20.    </telerik:GridViewDataColumn.Header>
21.</telerik:GridViewDataColumn>

 

Thanks ... Ed

 

Ivan Ivanov
Telerik team
 answered on 26 Jun 2018
1 answer
182 views

Hi Team,

 

I have to use AutoCompleteBox with multiple items, but I need to add some custom text between each selected items.

For an example, if the AutoCompleteBox is bound with following items like FileName, ReceivedDate, FileSize, etc., And the AutoCompleteBox with custom text and the selected items with cross buttons like below.

"File name is {FileName} and it is received on {ReceivedDate}"

 

Does this possible in AutoCompleteBox?

 

Regards,

Sathya

Kalin
Telerik team
 answered on 25 Jun 2018
2 answers
336 views
Hi Telerik ,

i have some problem to find a solution here for ..
first i am using RadGridView + MVVM + QueryableCollectionView.

The "pattern" is like this
My ViewModel  has a property named "Nodes" which is a derived class of  QueryableCollectionView which i am using because of paging feature.
The Problem i have is that the QueryableCollectionView is a wrapper for a IQueryable sourceCollection which is only set by constructor and there is not setter
for the wrapped source collection after its constructed.

So ok, i have done a workaround and creating a new Instance during RT of QueryableCollectionView with correct IQueryable parameter ( which by the way i do not have before ) and
set my ViewModel "Nodes" property to this new instance.

This works and i can see the Data correctly also paging works because the Grid gets notified about the change. ( it looks like so !)

In the "Nodes" Class i also have a "Command" property which is an Instance of a CommandProviderClass derived from prism.mvvm BindableBase ( which implements INotifyPropertyChanged )
and additionaly encapsulates a lot of other possible commands for Insert/Update/Delete .

And this "Command" property also gets replaced by the  "newer" instance of "Nodes" because the Nodes Class holds this property.
My ViewModel has a wrapper to this Nodes.CommandProvider

BUT ...


So now my Problem is raised during the Event "RowValidating" i found that the  User Control is still bound to old CommandProvider.DoValidatingRow 

because   

public ICommand DoValidatingRow { get; set; } // On Validate a Row
.... is initialized with
DoValidatingRow = new DelegateCommand<object>(OnValidatingRow);
 
But ICommand and DelegateCommand (Prism.Commands) Class have no INotifyPropertyChanged Contract defined.
 
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName ...

i already also called on my VM   this.RaisePropertyChanged(""); before the validation is called but no effect. It´s doesn´t change!

A) So my main Question is how can i tell the User Control to refresh all of it´s bounded Class Instances ?

B) Maybe is there another solution to replace the wrapped Source Collection in QueryableCollectionView , because this will solve the original problem ?

thanks br thomas cinatl


        <telerik:RadGridView x:Name="LookupListGridCtrl" ItemsSource="{Binding Nodes, Mode=TwoWay}" SelectedItem="{Binding Nodes.SelectedUiDataItem,Mode=TwoWay}"  Grid.Row="1"
                             AutoGenerateColumns="false" GroupRenderMode="Flat" NewRowPosition="Top" SelectionMode="Single" SelectionUnit="FullRow"
                             CanUserDeleteRows="True" ScrollMode="Deferred" IsSynchronizedWithCurrentItem="True" CanUserResizeColumns="True" CanUserSearch="True"
                             RowIndicatorVisibility="Visible" Margin="0,0,0,1" ValidationType="Default"
                             FilteringMode="FilterRow" ShouldCloseFilteringPopupOnKeyboardFocusChanged="True"
        >
 
            <telerik:EventToCommandBehavior.EventBindings>
                <telerik:EventBinding Command="{Binding CommandProvider.DoDeleteRow}" EventName="Deleted" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoInsertRow}" EventName="RowEditEnded" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoAddNew}" EventName="AddingNewDataItem" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoValidatingCell}" EventName="CellValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName="RowValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
                <telerik:EventBinding Command="{Binding CommandProvider.DoSelectionChanging}" EventName="SelectionChanging" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
            </telerik:EventToCommandBehavior.EventBindings>







 

Thomas
Top achievements
Rank 1
 answered on 23 Jun 2018
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?