Telerik Forums
UI for WPF Forum
2 answers
441 views
If I click the "Click here to add new item" row in my gridview, a new row appears as expected. However, as soon as I click anywhere other than on the new row (triggering RowEditEnded), the new row disappears from the gridview and the "Click here to add new item" row replaces it.

If I then save changes, the invisible row DOES save to the database and re-appears after a refresh. In other words, while the row disappears visually from the grid, it still exists in the datasource the grid binds to and is valid enough to save.

If I repeat the actions in the first paragraph 10 times and then save changes, 10 invisible rows will save to the database and reappear after a refresh.

What is going on here???

The gridview::

<telerik:RadGridView
    x:Name="LoanGrid"
    ItemsSource="{Binding Loans}"
    IsBusy="{Binding AreLoansBusy}"
    CanUserSelect="{Binding CanUserSelectLoans}"
    SelectedItem="{Binding SelectedLoan, Mode=TwoWay}"
    Margin="10,-6,10,10"
    GroupRenderMode="Flat"
    IsReadOnly="{Binding UserHasProjectRole, Converter={StaticResource NegationConverter}}"
    ColumnWidth="*"
    CanUserInsertRows="{Binding UserHasProjectRole}"
    SelectionMode="Single"
    NewRowPosition="Bottom"
    AutoGenerateColumns="False"
    IsSynchronizedWithCurrentItem="True"
    ShowGroupPanel="False"
    IsFilteringAllowed="False"
    ValidatesOnDataErrors="InEditMode"
    ActionOnLostFocus="CommitEdit"
    Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
 
    <telerik:RadGridView.Columns>
        <telerik:GridViewComboBoxColumn
            Header="Loan Type"
            IsReadOnly="False"
            DataMemberBinding="{Binding LoanTypeId}"
            SelectedValueMemberPath="Id"
            DisplayMemberPath="Description"
            ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.LoanTypes}"
            Width="Auto" />
        <telerik:GridViewDataColumn
            UniqueName="ApplicationAmount"
            Header="Application Amount"
            DataMemberBinding="{Binding ApplicationAmount, StringFormat=c2}"
            TextAlignment="Right"
            Width="Auto" />
        <telerik:GridViewDataColumn
            Header="Total Project Costs"
            DataMemberBinding="{Binding TotalProjectCosts, StringFormat=c2}"
            TextAlignment="Right"
            Width="Auto" />
        <telerik:GridViewDataColumn
            Header="Eligible Project Costs"
            DataMemberBinding="{Binding EligibleProjectCosts, StringFormat=c2}"
            TextAlignment="Right"
            Width="Auto" />
        <telerik:GridViewDataColumn
            Header="Interest Rate"
            DataMemberBinding="{Binding InterestRate, StringFormat='{}{0}%'}"
            TextAlignment="Right"
            Width="Auto" />
        <telerik:GridViewDataColumn
            Header="Indenture"
            DataMemberBinding="{Binding Indenture}"
            Width="Auto" />
        <telerik:GridViewDataColumn
            Header="EFC Bond Series"
            DataMemberBinding="{Binding EfcBondSeries}"
            Width="Auto" />
        <telerik:GridViewDataColumn
            Header="Auditing"
            IsReadOnly="True"
            Width="Auto">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding LastUpdatedBy}" />
                        <TextBlock Text="{Binding LastUpdatedDate, StringFormat=g}" Margin="5 0 0 0" />
                    </StackPanel>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
 
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="RowEditEnded">
            <infrastructure:InvokeDelegateCommandAction
        Command="{Binding LoanRowEditEndedCommand}"
        CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
        </i:EventTrigger>
        <i:EventTrigger EventName="Deleting">
            <infrastructure:InvokeDelegateCommandAction
        Command="{Binding LoanRowDeletingCommand}"
        CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
        </i:EventTrigger>
        <i:EventTrigger EventName="RowValidating">
            <infrastructure:InvokeDelegateCommandAction
        Command="{Binding LoanRowValidatingCommand}"
        CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</telerik:RadGridView>

The bound data source:

public QueryableDataServiceCollectionView<ProjectPhaseLoan> Loans { get; private set; }

Greg
Top achievements
Rank 1
 answered on 18 Dec 2014
4 answers
293 views
My application stores many small snippets of information in docx format. The individual information snippets must be stored internally in a way that can be easily accessed as a byte array (IList<byte> and ToArray() works). Another requirement is that the application be able to collate snippets into a document which can be exported.

I am able to use a DocxFormatProvider to import individual snippets to a RadFlowDocument, and can then use the Merge method of RadFlowDocument as necessary to achieve the desired result.

However, I am unable to import a snippet that is the result of the Merge method, if that snippet has been edited from inside a RadRichTextBox. Below is code to reproduce the issue.

MainWindow.xaml:
<Window x:Class="TelerikDocxManipulationTest.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="800" Width="1000">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
 
        <telerik:DocxDataProvider x:Name="DocxDataProvider"
                                  RichTextBox="{Binding ElementName=DataInput}"
                                  Docx="{Binding Data, Mode=TwoWay}">
        </telerik:DocxDataProvider>
 
        <StackPanel Orientation="Horizontal">
            <Button Grid.Column="1" Width="100" Margin="10,0,0,0" Click="Import">
                <TextBlock>
                    Import
                </TextBlock>
            </Button>
            <Button Grid.Column="1" Width="100" Margin="10,0,0,0" Click="Merge">
                <TextBlock>
                    Merge
                </TextBlock>
            </Button>
            <Button Grid.Column="1" Width="100" Margin="10,0,0,0" Click="Export">
                <TextBlock>
                    Export
                </TextBlock>
            </Button>
        </StackPanel>
         
        <telerik:RadRichTextBox x:Name="DataInput"
                                Grid.Row="1"
                                IsSpellCheckingEnabled="False"
                                HorizontalScrollBarVisibility="Hidden"
                                VerticalScrollBarVisibility="Visible"
                                LayoutMode="Paged"/>
    </Grid>
</Window>

MainWindow.xaml.cs:
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using Telerik.Windows.Documents.Flow.FormatProviders.Docx;
using Telerik.Windows.Documents.Flow.Model;
using Telerik.Windows.Documents.Flow.Model.Collections;
 
namespace TelerikDocxManipulationTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, INotifyPropertyChanged
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
        }
 
        /// <summary>
        /// Telerik DocxFormatProvider
        /// </summary>
        private DocxFormatProvider provider = new DocxFormatProvider();
 
        /// <summary>
        /// The binary data for the docx file
        /// </summary>
        private IList<byte> mData = new List<byte>();
        public IList<byte> Data
        {
            get
            {
                return mData;
            }
            set
            {
                mData = value;
                OnPropertyChanged("Data");
            }
        }
 
        /// <summary>
        /// Import a docx file from disk
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Import(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "docx files (*.docx)|*.docx";
            dialog.RestoreDirectory = true;
 
            if (dialog.ShowDialog() == true)
            {
                try
                {
                    Data = File.ReadAllBytes(dialog.FileName).ToList();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
 
        /// <summary>
        /// Merge the current document with a docx document from disk
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Merge(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "docx files (*.docx)|*.docx";
            dialog.RestoreDirectory = true;
 
            if (dialog.ShowDialog() == true)
            {
                try
                {
                    RadFlowDocument existingDocument = provider.Import(Data.ToArray());
                    RadFlowDocument mergeDocument = provider.Import(dialog.OpenFile());
 
                    existingDocument.Merge(mergeDocument);
 
                    Data = provider.Export(existingDocument).ToList();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
 
        /// <summary>
        /// Export the current file data to disk
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Export(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = "docx";
            dialog.Filter = "docx files (*.docx)|*.docx";
            dialog.RestoreDirectory = true;
 
            if (dialog.ShowDialog() == true)
            {
                using (Stream output = dialog.OpenFile())
                {
                    try
                    {
                        output.Write(Data.ToArray(), 0, Data.Count);
                        MessageBox.Show("Document exported.");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
 
 
        #region INotifiedProperty Block
        public event PropertyChangedEventHandler PropertyChanged;
 
        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
 
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}

Here are the steps to follow to reproduce the issue:

1) Open a docx file by clicking "Import"
2) Append a second docx file by clicking "Merge"
3) Edit the resulting document inside the RTB.
4) Append a third docx file by clicking "Merge"

An exception will be thrown at line 86 in MainWindow.xaml.cs by:
RadFlowDocument existingDocument = provider.Import(Data.ToArray());

The exception is:
"The given key was not present in the dictionary."



Also, I would be very grateful for any information about how I might remove the line break inserted between documents by the Merge method. When merging documents, there does not appear to be any line break in the RadRichTextBox. However, after clicking "Export" and saving the document, line breaks appear between the merged documents in Word.
Ricky
Top achievements
Rank 1
 answered on 18 Dec 2014
3 answers
851 views
Hi Team,
Please refer to the attachment "Enter key and Shift + Enter keys behavior.png". Please refer to the steps, I followed
1) Typed "firstline in paragraph1"
2) Pressed ENTER Key (it creates a new Paragraph)
3) Typed "second line in paragraph2"
Actual Result : Pressing ENTER key creates a new paragraph, so we have extra line space
Expected Result : If we press ENTER key, Can we have next line in same paragraph (without line space)

4) Typed "para 3 abcd"
5) Pressed SHIFT key + ENTER key
6) Typed "efgh"
Actual Result : Pressing SHIFT key + ENTER key creates a next line in same paragraph.
Expected Result : If we press SHIFT key + ENTER key, Can we have next line in NEW paragraph

I have tried the below approaches however no luck.
void utdRichTextEditor_PreviewEditorKeyDown(object sender, PreviewEditorKeyEventArgs e)
{
 if ((Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
      &&
      Keyboard.IsKeyDown(Key.Enter))
      {
      e.SuppressDefaultAction = true;
      }
      else if (Keyboard.IsKeyDown(Key.Enter))
      {
      e.SuppressDefaultAction = true;
        ((RadRichTextBox)sender).InsertLineBreak();
      }
}

private void SetLineSpacing()
{
 myRadRichTextBox.Document.LineSpacingType = LineSpacingType.Exact;
 myRadRichTextBox.DocumentInheritsDefaultStyleSettings = true;

 myRadRichTextBox.Document.LineSpacing = 0;
 myRadRichTextBox.Document.ParagraphDefaultSpacingAfter = 0;
 myRadRichTextBox.Document.ParagraphDefaultSpacingBefore = 0;
}

Thanks,
Obuliraj Ramalingam



Tanya
Telerik team
 answered on 18 Dec 2014
1 answer
429 views
Hi,

I'm using MVVM pattern on Diagram. I have a context menu set inside a style for targettype RadDiagramContainerShape. I want to pass the mouse position to the command as parameter (inside "NewShapeMenuItem" MenuItem).

How can I achieve this?

        <Style TargetType="telerik:RadDiagramContainerShape">            
            <Setter Property="ContextMenu">
                <Setter.Value>
                    <ContextMenu Name="ComponentContextMenu">
                        <MenuItem Name="NewMenuItem" Header="New">
                            <MenuItem Name="NewShapeMenuItem" Header="Shape" Command="{Binding AddCommand}" CommandParameter="{Binding ElementName=StateDiagram, Path=ActualHeight}" Icon="{StaticResource GoToShapeImage}"/>
                        </MenuItem>
                        <Separator/>
                        <MenuItem Header="Go to State" ItemsSource="{Binding ParentFacility.SelectedComponentViewModel.StateViewModels}"><!--IsEnabled="{Binding ParentFacility.Parent.IsOnline, Mode=TwoWay}"-->
                            <MenuItem.IsEnabled>
                                <MultiBinding Converter="{StaticResource ComponentToIsEnabledConverter}" Mode="TwoWay">
                                    <Binding Path="ParentFacility.Parent.IsOnline" Mode="TwoWay"/>
                                    <Binding Path="ParentFacility.SelectedComponentViewModel"/>
                                </MultiBinding>
                            </MenuItem.IsEnabled>
                            <MenuItem.ItemContainerStyle>
                                <Style TargetType="MenuItem">
                                    <Setter Property="Icon" Value="{StaticResource GoToStateImage}"></Setter>
                                    <Setter Property="Header" Value="{Binding Name}"></Setter>
                                    <Setter Property="Command" Value="{Binding ParentComponent.ParentFacility.GoToStateCommand}"></Setter>
                                    <Setter Property="CommandParameter" Value="{Binding}"></Setter>
                                </Style>
                            </MenuItem.ItemContainerStyle>
                        </MenuItem>
                    </ContextMenu>
                </Setter.Value>
            </Setter>
        </Style>

Pavel R. Pavlov
Telerik team
 answered on 18 Dec 2014
1 answer
131 views
Steps to reproduce:

1. Copy text from attach and paste it in the editor
2. Select a text and format it in red
3. Select other text and apply next formats: bold, italic, underline, strike
4. Select other text and highlight it
5. Go with cursor at the beginning of the text (before the bullet points) and press enter
6. Try to select any one from previously formatted texts

Aylin
Telerik team
 answered on 18 Dec 2014
1 answer
274 views
We're using the RadRichTextBox in a WPF application to create and store documents in a proprietary XML format.  We're using a formatter to convert them back to XAML for editing but we would also like to display requested documents on the web as PDF images.  While we can render a PDF version at the time the document is saved using RadRichTextBox, we would rather avoid the duplicate storage and render them as PDF when the document is requested from the site.

Is there a method for doing this type of conversion in a service?

Thanks in advance.
Petya
Telerik team
 answered on 18 Dec 2014
1 answer
198 views
Hello Telerik Team,

I have problems to display certain PDF Files. This time I don't even get a blank page as it was the case with the missing JBIG2Decode filter

Telerik user Georges already provides an example for a non working PDF File.

However I will just upload another one.

Thank you,
Joel

Note: I had to tamper with the file extension to surpass your "Allowed extensions" filter.
Deyan
Telerik team
 answered on 18 Dec 2014
1 answer
121 views
Hi,
I'm using Telerik version 2014.3.1202.40. The MaskedtextInput control in "Masked Input Text Input" Demo has an unexpected behavior.
Here is the configuration I have.
  Mask: (empty)
  Text Mode: MaskedText.
  Input Behavior: Replace
  Selection On Focus: SelectAll
  Update Value Event: LostFocus.

Replication Steps:
1. Type ABC in text input.
2. Select A. Copy A using Ctrl + C.
3. Move cursor after C. Paste using Ctrl + V.

What I expect: ABC becomes ABCA.
Actual result: (empty)

Please fix it! and test before releasing a new version!
It is not the first time that we have the copy-paste error on this control. It is one of the most basic function. 

/Gong
Petar Mladenov
Telerik team
 answered on 18 Dec 2014
3 answers
201 views
Currently we are implementing a scheduleview with a day/week/month view.

day and week view are working without problems. But we are running into problems while working with the month view.

For some reason some appointments are not showing up in the month view. The strange thing that it doesn't seem to be based a maximum number of appointments that can be shown in a month view. sometimes it is the 3th appointment of the day and sometimes the 6th. also it sometimes it is a appointment with a different start and end date but also on occasion one with the same start and end date.

Are there any known issue's on this point or any limits on how many/which appointments are chosen to be displayed in the month view?

regards,
Johan Lollinga
Ideo B.V.
Nasko
Telerik team
 answered on 18 Dec 2014
5 answers
146 views
Hello,

In my application have a TimeLine control with the SelectionMode="Extended", I need to select several items using the CTRL key.
In my scenario when I double click an item I show a window that will present some information related to the clicked item as you can see in the first attached image, I clicked the green item and the window is shown in the center of the screen.
Then when I want to close the window I click the button "Cerrar" (close) and after the window is closed I get the effect as if I clicked and dragged from the first item I clicked to the item behind the window (second attached image).

I wonder if there is a way to disable the range selection when using the SelectionMode="Extended", for my scenario I can't use the SelectionMode="Multiple" because I need to be able to select items using the CTRL key.

Or could you suggest another way to avoid the describes effect?

Thanks in advance,

Alberto
Benjamin
Top achievements
Rank 1
 answered on 18 Dec 2014
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
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?