Telerik Forums
UI for WPF Forum
1 answer
145 views
Dear sir,

Can I copy diagram items (shape or connection) as image in clipboard so that paste it into MS office or other applications?
If RadControl diagram does not support this functionality, Could you give me some tips for this?

Regards,
Tina Stancheva
Telerik team
 answered on 22 May 2013
5 answers
133 views
I would like to add a Table of Contents from code, is there documentation on how to do this?
Petya
Telerik team
 answered on 22 May 2013
5 answers
101 views
Hi,

how to find a DataFormField  <telerik:DataFormComboxField> on EditEnded?
I have to Change the value by code and have to find this field!

Thanks
Best Regards
Rene
Ivan Ivanov
Telerik team
 answered on 22 May 2013
1 answer
105 views
I have a solution where I am using the implicit themes and have a pallete switchers similar to what your Executive Dashboard is using. I have set up different gauge properties to switch when I click the theme toggle button. But i can not get the GaugeRange backgrounds to change. In fact they don't even display. Here is some sample code

<telerik:RadialScale x:Name="innerChannelRadialScale" Min="0" Max="300" Radius="0.68" MajorTicks="10" MinorTicks="5" LabelRotationMode="None"
FontWeight="Bold" FontSize="60" SweepAngle="359" StartAngle="90" ShowLastLabel="True" ShowFirstLabel="False"
MajorTickBackground="{DynamicResource MajorTickBackground}"
MiddleTickBackground="{DynamicResource MiddleTickBackground}"
MinorTickBackground="{DynamicResource MinorTickBackground}">
<telerik:RadialScale.Ranges>
       <telerik:GaugeRange x:Name="innerAlarmLowRange" Min="0" Max="50" StartWidth="0.04" EndWidth="0.01" Background="{DynamicResource AlertRangeBackground}" />
       <telerik:GaugeRange x:Name="innerNormalRange" Min="50" Max="250" StartWidth="0.01" EndWidth="0.01" Background="{DynamicResource NormalRangeBackground}" />
       <telerik:GaugeRange x:Name="innerAlarmHighRange" Min="250" Max="300" StartWidth="0.01" EndWidth="0.03" Background="#FFE50000" />
  </telerik:RadialScale.Ranges>

You will see I have set up DynamicResources for all of the Tick Backgrounds and they work perfectly. But the GaugeRange backgrounds do not work at all. In fact they do not show up at all. Is there something special I need to do to set DynamicResources on these?
Andrey
Telerik team
 answered on 22 May 2013
3 answers
290 views
I'd like to have two top-level TreeView items, which are not related to bindings. Simple hard coded top-level items. However, those items will have children. And those children will be from my VM.

Something like this:

<telerik:RadTreeViewItem
    ItemsSource="{Binding DataContext.Documents, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeView}}}">
    <TextBlock
        Text="Documents" />
</telerik:RadTreeViewItem>
<telerik:RadTreeViewItem
    ItemsSource="{Binding DataContext.Pages, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeView}}}">
    <TextBlock
        Text="Excluded Pages" />
</telerik:RadTreeViewItem>

However, this doesn't seem to be allowed. How can I accomplish this? Essentially, my VM has two collections of stuff, and I want to show both in a single tree view, but without introducing a bunch of stuff into my view model.
Kiril Vandov
Telerik team
 answered on 22 May 2013
3 answers
111 views
Hi,

I have a MVVM application which showed a strange behavior.
To reproduce it I "switched to event mode" which has:

<telerik:RadGridView Grid.Row="1" ItemsSource="{Binding Bearings}" AutoGenerateColumns="False" ShowInsertRow="True" ShowGroupPanel="False" RowValidating="RadGridView_RowValidating" CanUserDeleteRows="True" CanUserInsertRows="True">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn  Header="Ordnungszahl" Width="*" DataMemberBinding="{Binding Ordnungszahl}" IsFilterable="True" SortMemberPath="Ordnungszahl" IsSortable="True" />
            <telerik:GridViewDataColumn Header="BauartenCode" DataMemberBinding="{Binding BauartenCode}" Width="120" IsFilterable="False" IsSortable="True" />
            <telerik:GridViewDataColumn Header="AussenDMCode" DataMemberBinding="{Binding AussendurchmCode}" Width="120" IsFilterable="False" IsSortable="False" />
            <telerik:GridViewDataColumn Header="Stufe" DataMemberBinding="{Binding Stufe}" Width="120" IsFilterable="False" IsSortable="False"  />
            <telerik:GridViewDataColumn Header="Unterstufe" DataMemberBinding="{Binding Unterstufe}" Width="120" IsFilterable="False" IsSortable="False"/>
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>

In code behind I do nothing more than:

private void RadGridView_RowValidating(object sender, Telerik.Windows.Controls.GridViewRowValidatingEventArgs e) {
        e.IsValid = false;
    }


When I hit ESC twice - editing is ended and the "old values" are displayed - but the row still displays "invalid" (red exclamation mark, red background).

What I expect is that the row becomes valid since it has the original (valid) values after "CancelEdit" (Hitting ESC twice).

The second problem (in debug) I get a "ArgumentNullException" (Parameter instance must not be null) when I add a row without entering anything hit ESC twice.

Manfred
Yordanka
Telerik team
 answered on 22 May 2013
13 answers
143 views
Hi,
My gridview sort works great on mouse click but there is no response on touch input. Can you please tell me how to enable it for touch input?

Thanks.
Yordanka
Telerik team
 answered on 22 May 2013
3 answers
112 views
Hello,

I'm trying to export my GridView to csv and I'm getting the following error: Please provide writable stream for export!

   bei Telerik.Windows.Controls.GridView.GridViewDataControl.Export(Stream stream, GridViewExportOptions options) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Exporting\GridViewDataControl.Exporting.cs:Zeile 17.
   bei Data_Transfer_GUI.GridViewExportProvider.<>c__DisplayClass6.<Export>b__0()
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)



This is my code:

var grid = pExportObject as RadGridView;
if (grid != null)
{
    string extension = "csv";
    var dialog = new SaveFileDialog();
    dialog.DefaultExt = extension;
    dialog.Filter = "CSV (*.csv)|*.csv";
    dialog.FilterIndex = 1;
 
    var format = ExportFormat.Html;
 
    if (dialog.ShowDialog() == true)
    {
        FileInfo fi = new FileInfo(dialog.FileName);
 
        switch (fi.Extension)
        {
            case ".xls":
                format = ExportFormat.Html;
                break;
            case ".xml":
                format = ExportFormat.ExcelML;
                break;
            case ".doc":
                format = ExportFormat.Html;
                break;
            case ".csv":
                format = ExportFormat.Csv;
                break;
        }
 
        using (var stream = dialog.OpenFile())
        {
            var exportOptions = new GridViewExportOptions();
            exportOptions.Format = format;
            exportOptions.ShowColumnFooters = true;
            exportOptions.ShowColumnHeaders = true;
            exportOptions.ShowGroupFooters = true;
 
            try
            {
                // Check if this thread has access to this object.
                grid.Dispatcher.VerifyAccess();
 
                // The thread has access to the object, so update the UI.
                grid.Export(stream, exportOptions);
            }
            // Cannot access objects on the thread.
            catch (InvalidOperationException ex)
            {
                // Placing job onto the Dispatcher of the UI Thread.
                grid.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                    new Action(() => grid.Export(stream, exportOptions)));
            }                       
 
        }
    }


The error occurs at this line:

grid.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
    new Action(() => grid.Export(stream, exportOptions)));

When I hover the stream and open the tooltip I see that
stream.Length' threw an exception of type 'System.ObjectDisposedException'

Second thing is, that I can't understand why the InvalidOperationException is raised. The GridView is on the UI-Thread. It should be not necessary to invoke here. The export is called from a simple command which is called from the UI--Thread.

Do you have an idea why this all happens?

Thank you very much!
Kind regards







Dimitrina
Telerik team
 answered on 22 May 2013
1 answer
349 views
I have got an application with an outlook bar on one side and a panel on the other.  
I'm actually using a busy control.  When a user clicks on an option the specified control gets injected into the panel.  

This all works great and as it should.  My problem is that the scollbar never appears in the panel the control.  
I have a attached a pic and a link to a screen capture that may explain what i mean better.  



https://docs.google.com/file/d/0BwHgkQgjXmQvN0ZNVV9mTzNtdEU/edit?usp=sharing


<
Border  BorderBrush="Silver">
       <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="600" />
                 
            </Grid.ColumnDefinitions>
 
 
    <telerik:RadOutlookBar x:Name="outlookBar"
                           telerik:StyleManager.Theme="Office_Blue"
                        IsMinimized="{Binding ElementName=isMinimizedCheckBox, Path=IsChecked, Mode=TwoWay}"
                        IsMinimizable="{Binding ElementName=isMinimizableCheckBox, Path=IsChecked, Mode=TwoWay}"
                        IsVerticalResizerVisible="{Binding ElementName=isVerticalResizerVisibleCheckBox, Path=IsChecked, Mode=TwoWay}"
                         HorizontalAlignment="Stretch">
 
         <telerik:RadOutlookBarItem Header="Table Admin" FontWeight="Bold" x:Name="GroupTableAdmin"
                                     Icon="/Images/TableSmall.png" Tag="TableAdmin">
            <telerik:RadListBox Name="LstTableAdmin" SelectionMode="Single"
                                SelectionChanged="LstTableAdmin_SelectionChanged">
                <telerik:RadListBoxItem Content="Contracts" />
                <telerik:RadListBoxItem Content="Projects" />
                <telerik:RadListBoxItem Content="Task Types" />
                <telerik:RadListBoxItem Content="Task Groups" />
                <telerik:RadListBoxItem Content="Project/Contract" />
                <telerik:RadListBoxItem Content="TaskTypes/Groups" />
            </telerik:RadListBox>
        </telerik:RadOutlookBarItem>
 
        <telerik:RadOutlookBarItem Header="Work" FontWeight="Bold"  Icon="/Images/CalendarSmall.png">
                    <telerik:RadListBox Name="Lstworking" SelectionMode="Single"
                                        SelectionChanged="Lstworking_SelectionChanged">
                        <telerik:RadListBoxItem Content="Staff" />
                <telerik:RadListBoxItem Content="Full Time Days" />
                <telerik:RadListBoxItem Content="Part Time Days" />
            </telerik:RadListBox>
        </telerik:RadOutlookBarItem>
         
         
        <telerik:RadOutlookBarItem Header="Holidays" FontWeight="Bold"
                                   Icon="/Images/SunSmall.png">
            <telerik:RadListBox Name="LstHolidays" SelectionMode="Single">
                <telerik:RadListBoxItem Content="Public Holidays" />
            </telerik:RadListBox>
        </telerik:RadOutlookBarItem>
 
            <telerik:RadOutlookBarItem Header="My Staff" Icon="/Images/UsersSmall.png"
                                   x:Name="groupMyStaff" FontWeight="Bold" Tag="My Staff">
            <telerik:RadListBox Name="lstMyStaff" SelectionMode="Single"
                                        SelectionChanged="lstMyStaff_SelectionChanged"/>
        </telerik:RadOutlookBarItem>
         
    </telerik:RadOutlookBar>
     
      
      
 
      
 
    <telerik:RadBusyIndicator IsBusy="True" Grid.Column="1"
                            ScrollViewer.VerticalScrollBarVisibility="Visible"
                                Name="Progress" DisplayAfter="0"
                                telerik:StyleManager.Theme="Summer">
    </telerik:RadBusyIndicator>
 
 
 
    </Grid>
 
</Border>


Injected Control 

<UserControl
xmlns:TimeSheetsManagerControlLibrary="clr-namespace:TimeSheetsManagerControlLibrary"  
x:Class="ctrl_Contracts"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    
<UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../MyStyles.xaml" />
                <ResourceDictionary Source="../DataTemplates.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
</UserControl.Resources>
 
        <StackPanel VerticalAlignment="Top" Height="Auto">
 
        <telerik:RadButton Click="RadButton_Click" Width="200" HorizontalAlignment="Left" >
             <Image Source="/images/Print.png"/>
       </telerik:RadButton>
 
 
 
            <telerik:RadDataForm
Name="DataForm1"
     AutoGenerateFields="False" AutoEdit="True"
  AutoCommit="True"
    Style="{StaticResource MyDataFormStyle}"
ItemsSource="{Binding Contracts, Mode=TwoWay}"
CurrentItem="{Binding  SelectedItem,Mode=TwoWay}"
EditTemplate="{StaticResource ContractDataTemplate}"
NewItemTemplate="{StaticResource ContractDataTemplate}"
ReadOnlyTemplate="{StaticResource ContractDataTemplate}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="EditEnded">
                        <i:InvokeCommandAction Command="{Binding UpdateCommand}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </telerik:RadDataForm>
 
            <telerik:RadGridView x:Name="Grid" SelectionMode="Single"
                                 ScrollMode="RealTime" telerik:StyleManager.Theme="Summer"
                                 ScrollViewer.VerticalScrollBarVisibility="Visible"
                            ItemsSource="{Binding  Contracts, Mode=TwoWay}"
                            CurrentItem="{Binding  SelectedItem, Mode=TwoWay}"
                            SelectedItem="{Binding  SelectedItem, Mode=TwoWay}"
                            Style="{StaticResource MyGridViewStyle}"  >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="ContractCode" Width="90"
                                DataMemberBinding="{Binding ContractCode}" />
                    <telerik:GridViewDataColumn Header="ContractDescription" Width="290"
                                DataMemberBinding="{Binding ContractDescription}" />
                    <telerik:GridViewCheckBoxColumn Header="Current" Width="20"
                                DataMemberBinding="{Binding Current}" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
 
 
 
        </StackPanel>
     
</UserControl>




#Region "Private Methods"
    Private Sub LoadControl(Control As Object)
        Me.Progress.IsBusy = True

        Control.Load()

        Me.Progress.Content = Control
        Me.Progress.IsBusy = False
    End Sub
#End Region


Pavel R. Pavlov
Telerik team
 answered on 22 May 2013
0 answers
277 views
Hi,

I do have radautocompletebox with the dropdown button.

On clicking the button and on focus of the radautocomplete box, the dropdown is supposed to open.
The issue is when I select an item from the dropdown opened by button click and select an item from it, the selected item automatically sets to the text box inside the radautocompletebox thereby focusing on the same and the onFocus method gets called which is opening dropdown again which is not required.
This process happens so rapidly that two values (one from each dropdown) gets selected on a single click.
Kindly let me know in case if I am going wrong somewhere.

Below is the xaml code:
<ScrollViewer VerticalAlignment="Top" HorizontalScrollBarVisibility="Disabled" Grid.Column="0" VerticalScrollBarVisibility="Auto" Height="40" Width="186"  >
                        <telerik:RadAutoCompleteBox WatermarkContent="{Binding Path=WatermarkContent}"  HorizontalAlignment="Left" Name="radDeseaseCategoryAutoCompleteBox" Width="186"
                                    SelectionMode="Multiple"
                                    FilteringBehavior="{StaticResource EmptyTextFilteringBehavior}"
            TextSearchMode="Contains"
            TextSearchPath="Name" MinHeight="35"
                                     AutoCompleteMode="Suggest"
                                     ItemsSource="{Binding Path=DiseaseCategoryCollection, Source={StaticResource reportDropdownInfo}}"
                                     SelectedItems="{Binding Path=SelectedDiseaseCategoryCollection, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                                     GotFocus="DeseaseCompleteBoxGotFocus" LostFocus="DeseaseCompleteBoxLostFocus"
                                    >
                            <telerik:RadAutoCompleteBox.DropDownItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Name}" Width="190"/>
                                </DataTemplate>
                            </telerik:RadAutoCompleteBox.DropDownItemTemplate>
                            <telerik:RadAutoCompleteBox.BoxesItemTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Name}" IsEnabled="False" TextWrapping="Wrap" Width="140" MaxWidth="140"  Background="White" />
                                </DataTemplate>
                            </telerik:RadAutoCompleteBox.BoxesItemTemplate>
                        </telerik:RadAutoCompleteBox>
                    </ScrollViewer>
                    <telerik:RadButton Grid.Column="1" IsTabStop="False"
                               Click="DeseaseRadButtonClick"
                               VerticalAlignment="Top" HorizontalAlignment="Right"
                               Width="15"
                               Height="40" Grid.Row="1">
                        <Path Data="M0,0 L4,0 L4,4 z" Fill="Black" HorizontalAlignment="Right" Height="5" Stretch="Fill" VerticalAlignment="Center" Width="5" UseLayoutRounding="False" RenderTransformOrigin="0.5,0.5">
                            <Path.RenderTransform>
                                <RotateTransform Angle="135" />
                            </Path.RenderTransform>
                        </Path>
                    </telerik:RadButton>

Here is the method in code behind. .

 private void MechOfActRadButtonClick(object sender, RoutedEventArgs e)
        {
            radMecofActionAutoCompleteBox.Focus();
        }

        private void RadMecofActionAutoCompleteBoxGotFocus(object sender, RoutedEventArgs e)
        {
            radMecofActionAutoCompleteBox.WatermarkContent = "";
            radMecofActionAutoCompleteBox.Populate(radMecofActionAutoCompleteBox.SearchText);
        }
Avani
Top achievements
Rank 1
 asked on 22 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?