or
Feel free to let me know if you find any errors or more efficient ways to achieve the above.
Please upload your code if you extend the features of this code sample. Every little helps.
Rob
The property
'ColumnName'
was not found
in
type
'GridViewCell'
.
Hi,
I've notcied that when I try to print a document but push the cancel button the document is still sent to the printer.
Has anyone else noticed this?
I'm using libraries 2012.2.725.40.
Here's my print method:
private
void
btnPrint_Click(
object
sender, RoutedEventArgs e)
{
this
.radRichTextBox.Print(
"TAS2 Spec"
, PrintMode.Native);
}
Thanks for your time,
Rob
<
Window
x:Class
=
"RadControlsWpfApp3.InputsWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"InputsWindow"
Height
=
"400"
Width
=
"300"
>
<
Window.Resources
>
<
telerik:MetroTheme
x:Key
=
"Theme"
/>
<
Style
TargetType
=
"ScrollViewer"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
<
Style
TargetType
=
"TextBox"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
<
Style
TargetType
=
"Button"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
<
Style
TargetType
=
"CheckBox"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
<
Style
TargetType
=
"RadioButton"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
<
Style
TargetType
=
"ListBox"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
<
Style
TargetType
=
"PasswordBox"
>
<
Setter
Property
=
"telerik:StyleManager.Theme"
Value
=
"{StaticResource Theme}"
/>
</
Style
>
</
Window.Resources
>
<
Grid
>
<
StackPanel
Margin
=
"5"
>
<
Label
Content
=
"Username"
/>
<
TextBox
/>
<
Label
Content
=
"Password"
/>
<
PasswordBox
/>
<
Label
Content
=
"Gender"
/>
<
StackPanel
Orientation
=
"Horizontal"
>
<
RadioButton
Content
=
"Male"
/>
<
RadioButton
Content
=
"Female"
/>
</
StackPanel
>
<
Label
Content
=
"list"
/>
<
ListBox
>
<
ListBoxItem
>test1</
ListBoxItem
>
<
ListBoxItem
>test2</
ListBoxItem
>
<
ListBoxItem
>test3</
ListBoxItem
>
</
ListBox
>
<
CheckBox
Content
=
"Agree"
/>
<
Button
Content
=
"Submit"
/>
</
StackPanel
>
</
Grid
>
</
Window
>
<
Window
x:Class
=
"RadGridViewFocusStealing.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:RadGridViewFocusStealing
=
"clr-namespace:RadGridViewFocusStealing"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"50"
/>
<
RowDefinition
Height
=
"29"
/>
<
RowDefinition
Height
=
"259*"
/>
</
Grid.RowDefinitions
>
<
Grid.DataContext
>
<
RadGridViewFocusStealing:GridDataContextViewModel
/>
</
Grid.DataContext
>
<
TextBlock
Grid.Row
=
"0"
Text
=
"Make the RadPaneGroup as floating. Select a record inside of the grid, than add some new records while typing in the TextBox below. You will see the focus will lost. If the RadPaneGroup is docked its all fine."
TextWrapping
=
"Wrap"
/>
<
telerik:RadWatermarkTextBox
Grid.Row
=
"1"
Text
=
"{Binding Path=DoSomethingOnChange, UpdateSourceTrigger=Explicit}"
KeyUp
=
"TextBox_KeyUp"
Margin
=
"2"
>
<
telerik:RadWatermarkTextBox.WatermarkContent
>
<
TextBlock
Text
=
"Just type any text and press ↵ Enter to apply"
Foreground
=
"Gray"
/>
</
telerik:RadWatermarkTextBox.WatermarkContent
>
</
telerik:RadWatermarkTextBox
>
<
telerik:RadDocking
Grid.Row
=
"2"
>
<
telerik:RadDocking.Items
>
<
telerik:RadSplitContainer
x:Name
=
"radSplitContainer"
>
<
telerik:RadSplitContainer.Items
>
<
telerik:RadPaneGroup
>
<
telerik:RadPaneGroup.Items
>
<
telerik:RadPane
>
<
telerik:RadGridView
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding Path=DataItems}"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Property1}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
telerik:RadPane
>
</
telerik:RadPaneGroup.Items
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer.Items
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking.Items
>
</
telerik:RadDocking
>
</
Grid
>
</
Window
>
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Linq;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Input;
using
Telerik.Windows.Controls.Docking;
namespace
RadGridViewFocusStealing
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
radSplitContainer.InitialPosition = DockState.FloatingDockable;
}
private
void
TextBox_KeyUp(
object
sender, System.Windows.Input.KeyEventArgs e)
{
if
(e.Key == Key.Enter && e.KeyboardDevice.Modifiers == ModifierKeys.None)
{
var b = ((TextBox)sender).GetBindingExpression(TextBox.TextProperty);
if
(b !=
null
)
b.UpdateSource();
}
}
}
public
class
GridDataContextViewModel : INotifyPropertyChanged
{
private
IEnumerable<GridDataItem> _dataItems;
public
GridDataContextViewModel()
{
_dataItems =
new
GridDataItem[] {
new
GridDataItem() { Property1 =
"Foo"
},
new
GridDataItem() { Property1 =
"Baa"
} };
}
private
string
_doSomethingOnChange;
public
string
DoSomethingOnChange
{
get
{
return
_doSomethingOnChange; }
set
{
_doSomethingOnChange = value;
OnNotifyPropertyChanged(
"DoSomethingOnChange"
);
// As simulation, creating a new data array (e.g. a result of a SQLQuery as array) for GridView.ItemsSource
DataItems = _dataItems.Union(
new
GridDataItem[] {
new
GridDataItem { Property1 = value } }).ToArray();
}
}
public
IEnumerable<GridDataItem> DataItems
{
get
{
return
_dataItems; }
private
set
{
if
(_dataItems != value)
{
_dataItems = value;
OnNotifyPropertyChanged(
"DataItems"
);
}
}
}
private
void
OnNotifyPropertyChanged(
string
propertyName)
{
if
(PropertyChanged !=
null
)
PropertyChanged(
this
,
new
PropertyChangedEventArgs(propertyName));
}
public
event
PropertyChangedEventHandler PropertyChanged;
}
public
class
GridDataItem
{
public
string
Property1 {
get
;
set
; }
}
}