Telerik Forums
UI for WPF Forum
9 answers
5.4K+ 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
164 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
313 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
1 answer
114 views

Hello,

We are playing with the interactive form pdf and when you are in the field editing the text and then we go to save the document the field has not yet been updated with the new value.  Is there a way to force them out of the field editing and update the text of the field when they click the save button?

Thanks,

Brandon

Georgi
Telerik team
 answered on 22 Jun 2018
2 answers
205 views

Being new to Telerik controls I'm struggling to get RadGridView to populate automatically with SQL query collection.
I have some questions to understand what can and cannot be done and go from there:
I have a SQL query result collection contains over 4,000 records is there a way to set dump the datatable directly into the RadGridView with "AutoGenerateColumns="True"",
or do i have to iterate through all the rows?
Secondly I have the RadGridView in a tab of a RadPaneGroup. Which action should I use to only call the RadGridView population when its tab is selected?

Michael Bouhuys
Top achievements
Rank 1
 answered on 22 Jun 2018
4 answers
114 views

Hi,

I try to change text of "Grand Total" with Localization Manager, set the localization for "Pivot_GrandTotal", but nothing happened. Other text, such as "Pivot_AggregateSum", "Pivot_AggregateCount", and other are translated successfully, but "Pivot_GrandTotal" not.

Could you help me?

Thanks

Martin
Top achievements
Rank 1
 answered on 22 Jun 2018
3 answers
197 views

I am using the telerik library with version 2017.3.1018.45.
At the moment I'm struggling with a drag & drop implementation between a RadGridView and RadTreeView. A row must be draggable from the RadGridView to the RadTreeView only.
The drag & drop from the grid to the tree works perfectly. Unfortunately it is also possible to drop elements from the grid on the grid itself. The Effects property of GiveFeedBackEventArgs in OnGiveFeedback() is Move when staying with the mouse over the grid. It should be None though.

Setting AllowDrop=false on the grid does not make a difference.
I as well tried to disallow dropping before the mouse pointer leaves the grid - using OnDragLeave - but it fires as well when the pointer still is over the grid.
Another approach is to compare the source and destination when dropping. It does not seem possible though to figure out the drop destination in the OnDrop or OnDragDropCompleted events.

How can I omit dropping a grid element on the same grid?

Rico
Top achievements
Rank 1
 answered on 22 Jun 2018
5 answers
158 views

The shape's minheight is 60, The name of the object displays on the bottom of the shape, when  zoom out the  shape,  the name string may word wrap,  so the shape's minheight  is increase by a new line's height,   but when resizeing, the minheight of the bounds is not change,

how to solve this problem?

thanks!

Dinko | Tech Support Engineer
Telerik team
 answered on 22 Jun 2018
5 answers
123 views
Hi,

Is there a way to get the RadCalculatorPicker to display a cursor during input?  Right now, whatever user types shows in the TextBlock but it does not offer user the same look & feel as a regular input control.

Thanks.

Rubens.
Dinko | Tech Support Engineer
Telerik team
 answered on 22 Jun 2018
5 answers
122 views

Hi,

My application it's using the diagram and i needed to override the SelectAll() command since i have a special shape in the diagram i dont want to get deleted. This is the first shape added to the diagram. So diagram.Items[0].

I've created the newbinding as follows

 var controlAllBinding = new CommandBinding(DiagramCommands.SelectAll, OnSelectAllExecute, OnCanSelect);            CommandManager.RegisterClassCommandBinding(typeof(PatternDiagram), controlAllBinding);

And the implementation

  private static void OnSelectAllExecute(object sender, ExecutedRoutedEventArgs e)
        {
            var diagram = (sender as PatternDiagram);
            diagram.SelectAll();
            (diagram.Items[0] as RadDiagramShape).IsSelected = false; //This works
            (diagram.Items[1] as RadDiagramShape).IsSelected = false; //This works
        }

        private static void OnCanSelect(object sender, CanExecuteRoutedEventArgs e)
        {
            e.canExecute = true;

            e.Handled = true;
        }

 

However there are a few other items that are not RadDiagramShapes but they inherited from it (ProductShape : RadDiagramShape), there are 2 kinds of this products, the ones that are enabled and the ones that are disabled using the IsEnabled property.

So:

- 2 RadDiagramShapes (Rectangles) [CANNOT BE DELETED]

- 3 ProductShapes (IsEnabled = true) [SHOULD BE DELETED AND SELECTABLE]

- 3 ProductShapes (IsEnabled = false) [SHOULD NOT BE DELETED]

If i try to use a foreach inside the diagram.Items or diagram.SelectedItems and after that i try to check which ones are disabled and when i get them i try to use IsSelected = false (because i dont want them to be selected or deleted) it is not working.

I've tried to modify CanSelect, SelectAll, CanDelete, DeleteExecute, PreviewSelectionChange, SelectionChange with no luck.

Is there maybe about the ProductShape class that is not working? The class only has 2 properties and a predefined style.

 

Is there any way i can achieve this?

Thanks

Martin Ivanov
Telerik team
 answered on 22 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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?