Telerik Forums
UI for WPF Forum
4 answers
120 views

Hi,

 

i use c#/wpf RadGridView. I bound i Collection calls to my RadGridView. Here i have a RadGridViewDataColumn with a cell template checkbox.
My problem ist that i have perhaps 10 items in my collection with the same telephone-no. if i check one of these items i want to check the rest of
the items in my collection with the same no. too. Also if i uncheck one, i want to uncheck the rest to. How can i do this?

 

Thanks

Rene

Stefan Nenchev
Telerik team
 answered on 14 Feb 2017
1 answer
113 views

I have a grid view with the integer column sorted ascending by default.

At this time, for other event, I am updating this integer column and the values are getting modified in the UI correctly.

But at this case, the sorting is not getting applied correctly.

For example, By default my UI is like below

1

2

3

I have updated the row with value 2 with 5. Then my UI becomes

1

5

3

instead of 

1

3

5

 

Please let me know, how to achieve this.

Stefan Nenchev
Telerik team
 answered on 14 Feb 2017
3 answers
200 views

Hello. I bag your pardon, but I've come to desperation due to not founding a two-level Master/Detail example that uses two separate RadGridView (the first one for master records and the second one for detail records). Please give me an example of such an application where master records and detail records are added dynamically during run-time.

Thanks in advance.

Dmitry
Top achievements
Rank 1
 answered on 14 Feb 2017
3 answers
159 views

Hello,

i used RadGridView to show some items. I have defined some columns of RadGridView and bind ItemsSource with list of ViewModelABC, which is a type of IViewModel.

public interface IViewModel
{      
}
public Class ViewModelABC : IViewModel
{
    public string PropertyA { get; set; }
    public string PropertyB { get; set; }
    public string PropertyC { get; set; }
}
public Class MyData
{
    public MyData()
    {
        MyItems = new List<IViewModel>();

        // MyItems could be filled with ViewModelABC

        //MyItems.Add(new ViewModelABC());

    }
    public IList<IViewModel> MyItems {get;set;}
}

ViewModelABC has implemented the interface IViewModel and some properties.

When i start the application without Items, that meas, my MyData as DataContext is initialized, but it has no entry for ItemsSource in MyItems. Then i get ArgumentException from each column. "Property with name 'PropertyA' cannot be found on type 'IViewModel'.

I don't want to defined the list with type ViewModelABC. Is there another way to avoid the ArgumentException?

 

Thanks a lot.

Regards,

Ivan

Ivan
Top achievements
Rank 1
 answered on 14 Feb 2017
1 answer
123 views

Hi,

I have a RadCartesianChart with a HorizontalAxis set as LinearAxis, and the series are RangeBarSeries. The problem is that sometimes I have data on my chart only for a small range on the most left side, and some data for a small range on the most right side. In that case, I would like to skip showing on the chart that big empty gap in between.

So, its not only about hiding labels, its the LinearAxis that I don't want it to show 0->140 for example, but to show 0->30, 100->140 (etc)

Is it possible?

Martin Ivanov
Telerik team
 answered on 14 Feb 2017
7 answers
227 views

Hellow.

I do Master/Detail hierarchical RadGridView in the following manner. The View is:

<UserControl x:Class="RecordAndPlaybackSession.Views.RecordAndPlaybackSessionView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:commonControls="clr-namespace:CommonWpfControlLibrary;assembly=CommonWpfControlLibrary"
             prism:ViewModelLocator.AutoWireViewModel="True">
 
    <i:Interaction.Triggers>
        <!--<OK> dialog-->
        <prism:InteractionRequestTrigger SourceObject="{Binding NotificationRequest, Mode=OneWay}">
            <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
                <prism:PopupWindowAction.WindowContent>
                    <commonControls:NotificationDialogPopupView/>
                </prism:PopupWindowAction.WindowContent>
                <prism:PopupWindowAction.WindowStyle>
                    <Style TargetType="Window">
                        <Setter Property="ResizeMode" Value="NoResize"/>
                        <Setter Property="SizeToContent" Value="WidthAndHeight"/>
                    </Style>
                </prism:PopupWindowAction.WindowStyle>
            </prism:PopupWindowAction>
        </prism:InteractionRequestTrigger>
    </i:Interaction.Triggers>
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
         
        <Grid.Resources>
            <DataTemplate x:Key="RowDetailsTemplate">
                <telerik:RadGridView Name="SavedSesionsGrid" IsReadOnly="True" ItemsSource="{Binding SavedWorkingSesions}" AutoGenerateColumns="False" ShowGroupPanel="False">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Date}" Header="Session date"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Time_Begin}" Header="Time Begin"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Time_End}" Header="Time End"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Modbus_Transmision_Mode}" Header="MODBUS Transmision Mode"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Brief_Description}" Header="Brief Description" IsReadOnly="False"/>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
            </DataTemplate>
        </Grid.Resources>
         
        <telerik:RadGridView Grid.Row="0" Grid.Column="0" Name="DevicesGrid" ItemsSource="{Binding DevicesWithSavedSesions}" AutoGenerateColumns="False"
                             IsReadOnly="True" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False"
                             CanUserResizeRows="False" CanUserSearch="False" CanUserSortColumns="False" IsFilteringAllowed="False" SelectedItem="{Binding SelectedDevice}"
                             RowIndicatorVisibility="Collapsed" RowDetailsTemplate="{StaticResource RowDetailsTemplate}" Margin="5">
            <telerik:RadGridView.Columns>
                <telerik:GridViewToggleRowDetailsColumn/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding DisplayedName}" Header="Name"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding SerialNumber}" Header="Serial #/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding SelectedBeamsQuantity}" Header="Beams Quantity"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding SelectedInnerDiameter}" Header="Inner Diameter"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding CompanyOwnerOfDevice}" Header="Device Owner"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding MountingLocation}" Header="Locality"/>
                <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsCurrentlyConnected}" Header="Is Connected">
                    <telerik:GridViewCheckBoxColumn.CellStyle>
                        <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellStyle}">
                            <Setter Property="HorizontalContentAlignment" Value="Center" />
                        </Style>
                    </telerik:GridViewCheckBoxColumn.CellStyle>
                </telerik:GridViewCheckBoxColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
        <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center">
            <telerik:RadButton Height="25" Width="100" Margin="0 0 0 5" Content="Save" ToolTip="Save current sesion."
                               Command="{Binding SaveWorkingSessionCommand}"/>
            <telerik:RadButton Height="25" Width="100" Margin="10 0 10 5" Content="Stop" ToolTip="Stop saving process of current sesion"
                               Command="{Binding StopSavingOfWorkingSesionCommand}"/>
            <telerik:RadButton Height="25" Width="100" Margin="10 0 10 5" Content="Play" ToolTip="Play selected saving sesion"
                               Command="{Binding PlaySavedSessionCommand}"/>
            <telerik:RadButton Height="25" Width="100" Margin="0 0 0 5" Content="Delete" ToolTip="Delete selected saving session"
                               Command="{Binding DeleteSavedSessionCommand}"/>
        </StackPanel>
    </Grid>
</UserControl>

In the ViewModel I create (in particular) the folowing property that is bound to SelectedItem of master RadGridView. This is the user-selected device which session must be saved. Please see it below:

#region Properties
. . . . . . . . .      
public object SelectedDevice
{
     get { return this._selectedDevice; }
     set
     {
          if (this.SetProperty(ref this._selectedDevice, value))
          this.SaveWorkingSessionCommand.RaiseCanExecuteChanged();
     }
}
. . . . . . . . . . . . .
#endregion

And also the following properties:

#region Properties
 . . . . . . . . . . .
 /// <summary>
 /// Gets or sets the collection of devices that have saving sessions, and currently conected device.
 /// </summary>
 public ObservableCollection<Device> DevicesWithSavedSesions
 {
     get { return this._devicesWithSavedSessions; }
     set { this._devicesWithSavedSessions = value; }
 }
 
 /// <summary>
 /// Gets or sets the collection of saved working sessions per device.
 /// </summary>
 ObservableCollection<DeviceWorkingSession> SavedWorkingSesions
 {
     get
     {
         return this._savedWorkingSesions;//new ObservableCollection<DeviceWorkingSession>(this.DevicesWithSavedSesions.SelectMany(device => device.SavedWorkingSession));
     }
     set { this.SetProperty(ref this._savedWorkingSesions, value); }
 }
 . . . . . . . . . . .
 #endregion

I initialize these properties in constructor of ViewModel:

this.DevicesWithSavedSesions = new RadObservableCollection<Device>();
this.SavedWorkingSesions = new RadObservableCollection<DeviceWorkingSession>();

And in 'SaveWorkingSesionCommand' I do the following:

// Create instance of record with information about session being saved.
DeviceWorkingSession savedSession = new DeviceWorkingSession();
// GUID of saved sesion.
savedSession.Id = Guid.NewGuid();
// Id of device which sesion is saved.
savedSession.Devices_Id = GlobalStaticMembers.SharedProfileHeader.Id;
// Date of saving of the session.
DateTime sessionDateTime = DateTime.Now;
savedSession.Date = sessionDateTime.Date;
// Time when sesion saving begins
savedSession.Time_Begin = sessionDateTime.TimeOfDay;
savedSession.StrTimeBegin = savedSession.Time_Begin.ToString(@"hh\:mm\:ss\:fff");
// Transmision mode of MODBUS protocol.
savedSession.Modbus_Transmision_Mode = GlobalStaticMembers.ModbusTransmisionMode;
// Save session in 'Device' instance (in the manner as it done in your 'ExpandAllRowsDetails' example in your SDK).
(this.SelectedDevice as Device).SavedWorkingSession.Add(savedSession);
// Save session in collection that is binding source.
this.SavedWorkingSesions.Add(savedSession);

Below is the definition of SavedWorkingSession from Device class:

public ObservableCollection<DeviceWorkingSession> SavedWorkingSession
{
    get
    {
        if (this._savedWorkingSession == null)
           this._savedWorkingSession = new ObservableCollection<DeviceWorkingSession>();
        return this._savedWorkingSession;
    }
}

But I can not see detail records. Please see 'HierarchyMasterDetail.PNG' file attached. If you need more detail, please write me.

Stefan Nenchev
Telerik team
 answered on 14 Feb 2017
2 answers
142 views

Hi Team,

I have used the RadImageEditor to show the tif images in ListView. When clicking on RadImageEditor, the Selection is not processed in ListView, it is working fine when clicking over TextBlock. How to skip the mouse operations in RadImageEdiotr? Please refer the below code snippet.

 

<ControlTemplate TargetType="{x:Type ListViewItem}">
    <Border x:Name="PART_ImageView"
            BorderBrush="#D3D3D3"
            BorderThickness="1"
            Margin="10">
        <Grid Width="155"
              Height="195">
            <telerik:RadImageEditor Image="{Binding}"  
                                    AllowMouseWheelScaling="False"
                                    HorizontalContentAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    Style="{DynamicResource RadImageEditorStyle1}"
                                    ScaleFactor="0"/>
            <Border x:Name="PART_PageNoBorder"
                    Width="24"
                    Height="24"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Bottom"
                    Background="#D3D3D3"
                    BorderThickness="0">
                <TextBlock x:Name="PART_PageNo" FontSize="14"
                           FontFamily="Segoe UI"
                           Foreground="Gray"
                           Margin="4"
                           Text="01"/>
            </Border>
        </Grid>
    </Border>
    <ControlTemplate.Triggers>
        <Trigger Property="IsSelected" Value="True">
            <Setter TargetName="PART_ImageView"
                    Property="BorderBrush"
                    Value="#1ba1e2"/>
            <Setter TargetName="PART_PageNoBorder"
                    Property="Background"
                    Value="#1ba1e2"/>
            <Setter TargetName="PART_PageNo"
                    Property="Foreground"
                    Value="#FFFFFF"/>
        </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate>

 

Regards,

Antony Raj

Milena
Telerik team
 answered on 13 Feb 2017
2 answers
124 views

I am building a WPF form and using Telerik WPF 2017.1.117.  I have a pdf loading fine from an external URL, but when I call the .Print command nothing is spooled and no errors are generated.  After searching as much as I could, I can't find anything that would show why what I have is not working.  Thanks for any help you can provide.

 

using (WebClient client = new WebClient())
{
using (Stream ms = new MemoryStream(client.DownloadData(Properties.Settings.Default.URL + badgeURL)))
{
MemoryStream mStream = new MemoryStream();
mStream.SetLength(ms.Length);
ms.Read(mStream.GetBuffer(), 0, (int)ms.Length);
this.radPDF.DocumentSource = new PdfDocumentSource(mStream);
}
}

this.radPDF.Print(new PrintSettings("Document 1", true));

Jeff
Top achievements
Rank 1
 answered on 13 Feb 2017
0 answers
135 views

I've encountered a strange issue regarding the GridViewPinButton visibility in RadGridView.

My only wish is to disable this functionality- to set the GridViewPinButton visibility to collapse in every row in RadGridView.

Now, I have one place where it works great and another one where I can see this button while I'm hovering the rows.

In both places I haven't written any code concerning the GridViewPinButton , and in both cases the visibility of the button is set to collapsed.

The only difference I can see is in snoop (images are attached):
When it works well, GridViewPinButton does not have any child elements, while it has them in the second case.

 

When I click the button, I get the error:
Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "Telerik.Windows.Controls.GridView.Strings.resources" was correctly embedded or linked into assembly "Telerik.Windows.Controls.GridView" at compile time, or that all the satellite assemblies required are loadable and fully signed.
 at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.GetBlockAndPosition(Object item, Boolean deletedFromItems, GeneratorPosition& position, ItemBlock& block, Int32& offsetFromBlockStart, Int32& correctIndex)
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnItemReplaced(Object oldItem, Object newItem, Int32 index)
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
   at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Listener& listener, Object sender, EventArgs args, Type managerType)
   at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
   at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.DataItemCollection.OnPinnedItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.DataItemCollection.AddToPinnedItems(Object item)
   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.CommandManager.TransferEvent(IInputElement newSource, ExecutedRoutedEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Controls.Button.OnClick()
   at Telerik.Windows.Controls.RadButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Dmitri
Top achievements
Rank 1
 asked on 13 Feb 2017
2 answers
569 views

Hi,

I have a treeview that uses the datatemplate shown below. It has a context menu. I'd like to be able to disable or hide certain items depending on which node in the tree they click on. Is this possible? If so, can someone share some example code of how to do this in an MVVM fashion?

Thanks ... Ed

 

 

<HierarchicalDataTemplate DataType ="{x:Type vm:AttachmentContainer}"  ItemsSource="{Binding Children}">
    <TextBlock Text="{Binding Name}" >
           <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu  Opened="tv_ContextMenuOpened" >
                    <telerik:RadMenuItem x:Name="icon" Header="Upload File"   >
                        <telerik:RadMenuItem.Icon><Image Source="/Images/Upload.png"/></telerik:RadMenuItem.Icon>
                    </telerik:RadMenuItem>
                     <telerik:RadMenuItem Header="New Folder" >
                        <telerik:RadMenuItem.Icon>
                            <Image Source="/Images/NewFolder.png"/>
                        </telerik:RadMenuItem.Icon>
                     </telerik:RadMenuItem>
                     <telerik:RadMenuItem Header="Delete Folder" >
                        <telerik:RadMenuItem.Icon>
                            <Image Source="/Images/DeleteSmall.png"/>
                        </telerik:RadMenuItem.Icon>
                     </telerik:RadMenuItem>                               
                </telerik:RadContextMenu>
            </telerik:RadContextMenu.ContextMenu>
    </TextBlock>
</HierarchicalDataTemplate>
Randy Hompesch
Top achievements
Rank 1
 answered on 13 Feb 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?