You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
I've got some basic functionality for my app working and I am seeing an odd behavior.
The first time I type in a cell, it doesn't recognize a capital letter. After I've typed one lower case
letter I can delete the lowercase letter and enter an upper case one fine.
Reproduction instructions:
(1) Go to a cell thats never had entry in it before
(2) Type a single capital letter.
I've included my app code below, though I can't imagine how I could be causing this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using unvell.ReoGrid;
using Xceed.Wpf.Toolkit;
namespace ExceedDB
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public ReoGridRange currentRange;
public bool IgnoreFontChangeEvent = false;
private string lastFilePath;
public MainWindow()
{
InitializeComponent();
REOGrid.PickRange((inst, range) =>
{
currentRange = range;
// set font pulldowns
WorksheetRangeStyle styles = REOGrid.CurrentWorksheet.GetRangeStyle(range);
IgnoreFontChangeEvent = true;
FontSizeCombo.Text = styles.FontSize.ToString();
FontNameCombo.Text = styles.FontName.ToString();
IgnoreFontChangeEvent = false;
// set cell contents
CellContentsTextBox.Text = GetRangeValue(currentRange);
return false; // keeps the handler registered fror future callbacks
}, Cursors.Hand);
FontSizeCombo.SelectionChanged += FontSizeCombo_SelectionChanged;
FontNameCombo.SelectionChanged += FontNameCombo_SelectionChanged;
}
private string GetRangeValue(ReoGridRange currentRange)
{
object[,] data = REOGrid.CurrentWorksheet.GetRangeData(currentRange);
object cornerData = data[0, 0];
if (cornerData == null)
{
return "";
}
for (int y = 0; y < data.GetLength(1); y++)
{
for (int x = 0; x < data.GetLength(0); x++)
{
if ((data.[x,y]== null) ||(!data[x, y].Equals(cornerData)))
{
return ""; ;
}
}
}
return cornerData.ToString();
}
private void FontNameCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (IgnoreFontChangeEvent)
{
return;
}
string fontName = (e.AddedItems[0] as System.Windows.Media.FontFamily).ToString();
WorksheetRangeStyle styles = REOGrid.CurrentWorksheet.GetRangeStyle(currentRange);
styles.FontName = fontName;
REOGrid.CurrentWorksheet.SetRangeStyles(currentRange, styles);
}
private void FontSizeCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (IgnoreFontChangeEvent)
{
return;
}
//Console.WriteLine("Selected nuim is " + FontSizeCombo.SelectedItem);
float fontSize = Single.Parse((e.AddedItems[0] as ComboBoxItem).Content as string);
WorksheetRangeStyle styles = REOGrid.CurrentWorksheet.GetRangeStyle(currentRange);
styles.FontSize = fontSize;
REOGrid.CurrentWorksheet.SetRangeStyles(currentRange, styles);
}
private void New_Workbook(object sender, RoutedEventArgs e)
{
Console.WriteLine("New");
}
private void Import_File(object sender, RoutedEventArgs e)
{
// Create OpenFileDialog
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
// Set filter for file extension and default file extension
dlg.DefaultExt = ".rgf";
dlg.Filter = "REO Files (*.rgf)|*.rgf";
// Display OpenFileDialog by calling ShowDialog method
Nullable<bool> result = dlg.ShowDialog();
// Get the selected file name and display in a TextBox
if (result == true)
{
// Open document
string filename = dlg.FileName;
REOGrid.CurrentWorksheet.LoadRGF(filename);
lastFilePath = filename;
}
}
private void Export_File(object sender, RoutedEventArgs e)
{
Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
// Set filter for file extension and default file extension
dlg.DefaultExt = ".rgf";
dlg.Filter = "REO Files (*.rgf)|*.rgf";
dlg.FileName = lastFilePath;
// Display SaveFileDialog by calling ShowDialog method
Nullable<bool> result = dlg.ShowDialog();
// Get the selected file name and display in a TextBox
if (result == true)
{
// Open document
string filename = dlg.FileName;
REOGrid.CurrentWorksheet.SaveRGF(filename);
lastFilePath = filename;
}
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
Console.WriteLine("FIle...");
}
}
}
XAML File
<Window x:Class="ExceedDB.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rg="clr-namespace:unvell.ReoGrid;assembly=unvell.ReoGrid"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="MainWindow" Height="350" Width="525">
<DockPanel>
<StackPanel DockPanel.Dock="Top">
<Menu>
<MenuItem Header="_File" Click="MenuItem_Click">
<MenuItem Header="_New" Click="New_Workbook"/>
<MenuItem Header="_Import" Click="Import_File"/>
<MenuItem Header="_Export" Click="Export_File"/>
</MenuItem>
</Menu>
<ToolBarTray>
<ToolBar>
<ToolBar.Resources>
<CollectionViewSource Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}" x:Key="familyCollection"/>
</ToolBar.Resources>
<Label>Font size:</Label>
<ComboBox x:Name="FontSizeCombo" IsEditable="True" IsReadOnly="True">
<Label>Font size:</Label>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem IsSelected="True">12</ComboBoxItem>
<ComboBoxItem>14</ComboBoxItem>
<ComboBoxItem>16</ComboBoxItem>
</ComboBox>
<ComboBox x:Name="FontNameCombo" ItemsSource="{Binding Source={StaticResource familyCollection}}">
</ComboBox>
<Label>Cell Contents:</Label>
<TextBox x:Name="CellContentsTextBox" Width="200"></TextBox>
</ToolBar>
</ToolBarTray>
</StackPanel>
<Grid>
<rg:ReoGridControl x:Name="REOGrid" >
</rg:ReoGridControl>
</Grid>
</DockPanel>
</Window>
Offline
Thanks for the information! I have confirmed that cannot input a capital letter is a bug in current WPF edition.
A fixed version will be released within few days. Sorry for the inconvenience.
Offline
Its a Beta, such things are expected. Thank you for the prompt response!
Offline
Have you confirmed that problem has been fixed in latest version?
Offline