or
One TextBox is outside of RadPropertyGrid and One TextBox is inside RadPropertyGrid. The two are set to IsReadOnly=True, but only the outside one actually show read-only.
Version: Telerik.Windows.Controls.Data, Version=2013.3.1316.45.
Compiled with .Net 4.5
WPF app.
<
Window
x:Class
=
"PropGridTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Name
=
"ThisControl"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
TextBox
IsReadOnly
=
"True"
Text
=
"Read-only"
/>
<
telerik:RadPropertyGrid
Grid.Row
=
"1"
AutoGeneratePropertyDefinitions
=
"False"
Item
=
"{Binding ElementName=ThisControl}"
>
<
telerik:RadPropertyGrid.PropertyDefinitions
>
<
telerik:PropertyDefinition
DisplayName
=
"Prop 1"
GroupName
=
"Group 1"
OrderIndex
=
"0"
>
<
telerik:PropertyDefinition.EditorTemplate
>
<
DataTemplate
DataType
=
"telerik:PropertyDefinition"
>
<
TextBox
HorizontalAlignment
=
"Left"
IsReadOnly
=
"True"
Text
=
"Read-only"
Width
=
"100"
/>
</
DataTemplate
>
</
telerik:PropertyDefinition.EditorTemplate
>
</
telerik:PropertyDefinition
>
</
telerik:RadPropertyGrid.PropertyDefinitions
>
</
telerik:RadPropertyGrid
>
</
Grid
>
</
Window
>
<!-- Tile Style -->
<
Style
TargetType
=
"{x:Type telerik:Tile}"
>
<
Setter
Property
=
"Background"
>
<
Setter.Value
>
<
LinearGradientBrush
>
<
GradientStop
Color
=
"{Binding RelativeSource={RelativeSource AncestorType={x:Type telerik:Tile}, Mode=FindAncestor}, Path=Content.Color.StartColor}"
Offset
=
"0.0"
/>
<
GradientStop
Color
=
"{Binding RelativeSource={RelativeSource AncestorType={x:Type telerik:Tile}, Mode=FindAncestor}, Path=Content.Color.EndColor}"
Offset
=
"1.0"
/>
</
LinearGradientBrush
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"TileType"
Value
=
"{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content.Size, Converter={StaticResource tileTypeConverter}}"
/>
<Setter Property="DisplayIndex" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type telerik:Tile}, Mode=FindAncestor}, Path=Content.DisplayIndex, Mode=OneTime}" />
</
Style
>
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=StartPoint; DataItem=null; target element is 'PathFigure' (HashCode=17749809); target property is 'StartPoint' (type 'Point')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=StartBezierPoint; DataItem=null; target element is 'LineSegment' (HashCode=40121966); target property is 'Point' (type 'Point')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=EndPoint; DataItem=null; target element is 'PathFigure' (HashCode=45256881); target property is 'StartPoint' (type 'Point')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=EndBezierPoint; DataItem=null; target element is 'LineSegment' (HashCode=41585520); target property is 'Point' (type 'Point')
public
partial
class
ManufacturersAndPartsSearch : Window
{
private
ViewModels.ManufacturersAndPartsSearchViewModel vm;
public
ManufacturersAndPartsSearch()
{
InitializeComponent();
var context =
new
ViewModels.ManufacturersAndPartsSearchViewModel(
this
);
this
.vm = context;
this
.DataContext = vm;
GridViewTableDefinition d =
new
GridViewTableDefinition();
d.Relation =
new
Telerik.Windows.Data.PropertyRelation(
"ChildParts"
);
//add child table defination to gridview
this
.GridView.ChildTableDefinitions.Add(d);
this
.GridView.DataLoaded += GridView_DataLoaded;
//this is to alter changes to each child grid
this
.GridView.DataLoading += GridView_DataLoading;
//event to check and set the view model's current row to a heirarchial's currently selected row if selected
//explanation
/*The original code used data binding to set the current row in the viewmodel equal to the current row in the grid
this worked for the original purpose; however, since heirarchial grids are created for each row in the parent grid
that has parts saved in the database then there is no way to bind their currently selected row properties to the viewmodel
The databinding was ditched and instead this route was taken which accounts for both types of grids*/
this
.GridView.SelectionChanged += GridView_SelectionChanged;
}
void
GridView_SelectionChanged(
object
sender, SelectionChangeEventArgs e)
{
var grid = sender
as
RadGridView;
var item = grid.SelectedItem;
this
.vm.CurrentItem = item;
MessageBox.Show(item.GetType().ToString());
}
public
class
PartsManufacturerViewModel : Accu_Base_Lib.Bases.ModelViewModelBase<DAL.PartsManufacturer>
{
public
string
Id
{
get
{
return
(
string
)GetValue(IdProperty); }
set
{ SetValue(IdProperty, value); }
}
// Using a DependencyProperty as the backing store for Id. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty IdProperty =
DependencyProperty.Register(
"Id"
,
typeof
(
string
),
typeof
(PartsManufacturerViewModel));
public
string
Name
{
get
{
return
(
string
)GetValue(NameProperty); }
set
{ Debug.WriteLine(
"ViewModel Name Changed "
+
this
.Name); SetValue(NameProperty, value); }
}
// Using a DependencyProperty as the backing store for Name. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty NameProperty =
DependencyProperty.Register(
"Name"
,
typeof
(
string
),
typeof
(PartsManufacturerViewModel));
private
ObservableCollection<PartViewModel> _childParts;
public
ObservableCollection<PartViewModel> ChildParts
{
get
{
if
(
this
._childParts ==
null
)
{
GetChildren();
}
return
this
._childParts;
}
set
{
this
._childParts = value;
}
}
public
PartsManufacturerViewModel(DAL.PartsManufacturer model)
{
base
.Init(model);
//Fills this viewmodel based off the model supplied.
UpdateViewModelFromModel();
}
public
PartsManufacturerViewModel()
{
base
.Init();
this
.Model.Id = Guid.NewGuid().ToString();
this
.Model.Name =
string
.Empty;
UpdateViewModelFromModel();
}
public
class
PartViewModel : Accu_Base_Lib.Bases.ModelViewModelBase<DAL.Part>
{
public
string
Id
{
get
{
return
(
string
)GetValue(IdProperty); }
set
{ SetValue(IdProperty, value); }
}
// Using a DependencyProperty as the backing store for Id. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty IdProperty =
DependencyProperty.Register(
"Id"
,
typeof
(
string
),
typeof
(PartViewModel));
public
string
ManufacturerId
{
get
{
return
(
string
)GetValue(ManufacturerIdProperty); }
set
{ SetValue(ManufacturerIdProperty, value); }
}
// Using a DependencyProperty as the backing store for ManufacturerId. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty ManufacturerIdProperty =
DependencyProperty.Register(
"ManufacturerId"
,
typeof
(
string
),
typeof
(PartViewModel));
public
string
Name
{
get
{
return
(
string
)GetValue(NameProperty); }
set
{ SetValue(NameProperty, value); }
}
// Using a DependencyProperty as the backing store for Name. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty NameProperty =
DependencyProperty.Register(
"Name"
,
typeof
(
string
),
typeof
(PartViewModel));
public
string
ModelNo
{
get
{
return
(
string
)GetValue(ModelNoProperty); }
set
{ SetValue(ModelNoProperty, value); }
}
// Using a DependencyProperty as the backing store for ModelNo. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty ModelNoProperty =
DependencyProperty.Register(
"ModelNo"
,
typeof
(
string
),
typeof
(PartViewModel));
public
decimal
Price
{
get
{
return
(
decimal
)GetValue(PriceProperty); }
set
{
SetValue(PriceProperty, value); }
}
// Using a DependencyProperty as the backing store for Price. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty PriceProperty =
DependencyProperty.Register(
"Price"
,
typeof
(
decimal
),
typeof
(PartViewModel));
public
PartViewModel(DAL.Part model)
{
base
.Init(model);
//Fills this viewmodel based off the model supplied.
UpdateViewModelFromModel();
}
public
PartViewModel()
{
base
.Init();
this
.Model.Id = Guid.NewGuid().ToString();
UpdateViewModelFromModel();
}