<
Grid
>
<
telerik:RadScheduleView
AppointmentsSource
=
"{Binding Items}"
DockPanel.Dock
=
"Top"
IsManipulationEnabled
=
"False"
VerticalAlignment
=
"Top"
VirtualizingStackPanel.VirtualizationMode
=
"Standard"
VirtualizingStackPanel.IsVirtualizing
=
"False"
SnapAppointments
=
"True"
NavigationHeaderVisibility
=
"Collapsed"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:WeekViewDefinition
DayEndTime
=
"19:00:00"
DayStartTime
=
"07:00:00"
MajorTickLength
=
"1h"
MinorTickLength
=
"1h"
TimerulerMajorTickStringFormat
=
"{}{0:HHtt}:{0:mm}"
TimerulerMinorTickStringFormat
=
"{}{0:HHtt}:{0:mm}"
ShowAllDayArea
=
"False"
MinTimeRulerExtent
=
"300"
VisibleDays
=
"5"
>
</
telerik:WeekViewDefinition
>
<
telerik:DayViewDefinition
TimerulerMajorTickStringFormat
=
"{}{0:HHtt}:{0:mm}"
TimerulerMinorTickStringFormat
=
"{}{0:HHtt}:{0:mm}"
ShowAllDayArea
=
"False"
DayEndTime
=
"19:00:00"
DayStartTime
=
"07:00:00"
MajorTickLength
=
"1h"
MinorTickLength
=
"1h"
>
</
telerik:DayViewDefinition
>
<
telerik:MonthViewDefinition
TimerulerMajorTickStringFormat
=
"{}{0:HHtt}:{0:mm}"
DayEndTime
=
"19:00:00"
DayStartTime
=
"07:00:00"
StretchGroupHeaders
=
"False"
>
</
telerik:MonthViewDefinition
>
</
telerik:RadScheduleView.ViewDefinitions
>
</
telerik:RadScheduleView
>
</
Grid
>
private
QueryableEntityCollectionView<PROTOCOL> protocolsView;
public
QueryableEntityCollectionView<PROTOCOL> ProtocolsView
{
get
{
return
protocolsView; }
set
{
protocolsView = value;
RaisePropertyChanged(
"ProtocolsView"
);
}
}
Task.Factory.StartNew(
new
Action(() =>
{
DbContext dbContext =
new
wafintellectEntities(Global.Configuracion.CadenaConexionBDEntity);
// connection to BD
ObjectContext objectContext = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)dbContext).ObjectContext;
bool
error =
false
;
try
{
//ProtocolsView = new QueryableEntityCollectionView<PROTOCOL>(objectContext, "PROTOCOLs");
results =
new
QueryableEntityCollectionView<PROTOCOL>(objectContext,
"PROTOCOLs"
);
}
catch
(Exception e)
{
error =
true
;
MessageBox.Show(
"Cadena de conexión errónea. Por favor, configure la conexión con la BD correctamente."
+ System.Environment.NewLine + e.Message,
"Imposible cargar datos"
, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
}
mi.Invoke(
new
Action(() =>
{
if
(!error)
{
ProtocolsView = results;
// "ProtocolsView " is the property binded to my RadGridView
}
}));
}));
<telerik:RadGridView
x:Name=
"grdProtocol"
ItemsSource=
"{Binding ProtocolsView}"
AutoGenerateColumns=
"False"
SelectionUnit=
"FullRow"
GridLinesVisibility=
"Horizontal"
CanUserDeleteRows=
"False"
CanUserInsertRows=
"False"
CanUserFreezeColumns=
"False"
RowIndicatorVisibility=
"Collapsed"
IsReadOnly=
"True"
ShowGroupPanel=
"False"
Grid.ColumnSpan=
"2"
>
</telerik:RadGridView>
private
IQueryable protocolsView;
public
IQueryable ProtocolsView
{
get
{
return
protocolsView; }
set
{
protocolsView = value;
RaisePropertyChanged(
"ProtocolsView"
);
}
}
Task.Factory.StartNew(
new
Action(() =>
{
try
{
wafintellectEntities myEntity =
new
wafintellectEntities(Global.Configuracion.CadenaConexionBDEntity);
// connection to BD
ProtocolsView = myEntity.PROTOCOLs;
// get the entire data of the table PROTOCOLs
}
catch
{
MessageBox.Show(
"Error al abrir BD..."
);
}
}));
<Window x:Class="TabPanelInstanceValidator.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" xmlns:tabPanelInstanceValidator="clr-namespace:TabPanelInstanceValidator" Title="MainWindow" Height="350" Width="525"> <telerik:RadTabControl ItemsSource="{Binding}" DisplayMemberPath="header" > <telerik:RadTabControl.ContentTemplate> <DataTemplate> <telerik:RadDocking> <telerik:RadDocking.DocumentHost> <telerik:RadGridView AutoGenerateColumns="False" ShowGroupPanel="False" ItemsSource="{Binding Elements}" > <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path}" Width="*" Header="elements"></telerik:GridViewDataColumn> </telerik:RadGridView.Columns> <telerik:RadGridView.RowStyle> <Style TargetType="telerik:GridViewRow"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <telerik:RadExpander ExpandDirection="Down" Name="check" Header="{Binding Path}"> <GroupBox> <GroupBox.Header> <CheckBox>ShowAll</CheckBox> </GroupBox.Header> <tabPanelInstanceValidator:CustomRadGridView AutoGenerateColumns="False" AssignableColumns="{Binding}" DataContext="{Binding FeedData}" RowIndicatorVisibility="Hidden" > </tabPanelInstanceValidator:CustomRadGridView> </GroupBox> </telerik:RadExpander> </ControlTemplate> </Setter.Value> </Setter> </Style> </telerik:RadGridView.RowStyle> </telerik:RadGridView> </telerik:RadDocking.DocumentHost> <telerik:RadSplitContainer InitialPosition="DockedLeft"> <telerik:RadPaneGroup> <telerik:RadPane IsPinned="False" CanFloat="False" Header="Legend"> <StackPanel> <Button Click="ButtonBase_OnClick">changedatacontext</Button> <TextBlock>test</TextBlock> </StackPanel> </telerik:RadPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> </DataTemplate> </telerik:RadTabControl.ContentTemplate> </telerik:RadTabControl> </Window> the code behind for same is -using System; using System.Collections.Generic; using System.Windows; using System.Windows.Input; namespace TabPanelInstanceValidator { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); List<Rules> abc = new List<Rules>(); abc.Add(new Rules("interface Rule") { Elements = new List<ElementRule>() { new ElementRule("Motor|Control") { FeedData = new List<RuleCollect>() { new RuleCollect() { element = "sample", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Optional" } } }, new RuleCollect() { element = "sample1", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Required" } } }, }} ,new ElementRule("Motor|SuperVision") { FeedData = new List<RuleCollect>() { new RuleCollect() { element = "sample", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Optional" } } }, new RuleCollect() { element = "sample1", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" } } }, }}} }); abc.Add(new Rules("element rules") { Elements = new List<ElementRule>() { new ElementRule("Motor|sbdk1") { FeedData = new List<RuleCollect>() { new RuleCollect() { element = "sample", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Optional" } } }, new RuleCollect() { element = "sample1", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Required" } } }, }}, new ElementRule("Motor|sbdk2") { FeedData = new List<RuleCollect>() { new RuleCollect() { element = "sample", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Optional" }, new Rule() { name = "RuleTest3", status = "Prohibited" } } }, new RuleCollect() { element = "sample1", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Required" }, new Rule() { name = "RuleTest3", status = "Prohibited" } } }, } } } }); this.DataContext = abc; } private void UIElement_OnMouseEnter(object sender, MouseEventArgs e) { throw new NotImplementedException(); } private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { List<Rules> abc = new List<Rules>(); abc.Add(new Rules("interface Rule") { Elements = new List<ElementRule>() { new ElementRule("Motor|Control") { FeedData = new List<RuleCollect>() { new RuleCollect() { element = "sample", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Optional" } } }, new RuleCollect() { element = "sample1", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Required" } } }, }} ,new ElementRule("Motor|SuperVision") { FeedData = new List<RuleCollect>() { new RuleCollect() { element = "sample", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" }, new Rule() { name = "RuleTest2", status = "Optional" } } }, new RuleCollect() { element = "sample1", rules = new List<Rule>() { new Rule() { name = "RuleTest", status = "Required" } } }, }}} }); abc.Add(new Rules("testrule") { Elements = new List<ElementRule>() { new ElementRule("check")} }); this.DataContext = abc; // aa.SelectedIndex = 1; } } }
N.B. Framework 4.5
// first in Application App.cs set at runtime theme windows8
protected override void OnStartup(StartupEventArgs e)
{
StyleManager.ApplicationTheme = new Windows8Theme();
}
// Then create two VIEW
// First is MASTER_VIEW
// ADD XAML
<telerik:RadTabControl Grid.Row="0" >
<telerik:RadTabItem DropDownContent="Trend Import" Header="DETAIL" >
<telerik:RadTabItem.Content>
<views:DETAIL_VIEW/>
</telerik:RadTabItem.Content>
</telerik:RadTabItem>
</telerik:RadTabControl>
// ADD SECOND XAML -> DETAIL_VIEW <GroupBox Header="tyy tyy" >
<TextBlock Text="Settings"/>
</GroupBox>
</Grid>
Build and run WPF APPLICATION
TextBlock is not visible. Cannot see content(Text) of any TextBlock controls?
I use default style at all.
Workaround:
Remove: OnStartup(StartupEventArgs e) function, stay at default theme.
You will see all textblock controls again.
Additional info: This bug depends and others controls like GroupBox and others.
Framework 4.5
VS2012
Telerik v. 2013.2.611.45 (For framework 4.5)
This is styles that I use. In comment is second workaround.
<
ResourceDictionary
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
>
<
ControlTemplate
x:Key
=
"TextBoxErrorTemplate"
>
<
DockPanel
LastChildFill
=
"True"
>
<
Border
BorderBrush
=
"Red"
BorderThickness
=
"1"
>
<
AdornedElementPlaceholder
x:Name
=
"Holder"
/>
</
Border
>
<
Label
Foreground
=
"White"
Content
=
"{Binding ElementName=Holder, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
BorderThickness
=
"1"
BorderBrush
=
"White"
Background
=
"Red"
UseLayoutRounding
=
"True"
/>
</
DockPanel
>
</
ControlTemplate
>
<
Style
TargetType
=
"Button"
>
<
Style.Triggers
>
<
Trigger
Property
=
"Validation.HasError"
Value
=
"true"
>
<
Setter
Property
=
"IsEnabled"
Value
=
"False"
/>
</
Trigger
>
<
Trigger
Property
=
"Validation.HasError"
Value
=
"false"
>
<
Setter
Property
=
"IsEnabled"
Value
=
"True"
/>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
<
Style
x:Key
=
"LinkButton"
TargetType
=
"Button"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"Button"
>
<
TextBlock
TextDecorations
=
"Underline"
>
<
ContentPresenter
/>
</
TextBlock
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"Foreground"
Value
=
"Blue"
/>
<
Setter
Property
=
"Cursor"
Value
=
"Hand"
/>
<
Style.Triggers
>
<
Trigger
Property
=
"IsMouseOver"
Value
=
"true"
>
<
Setter
Property
=
"Foreground"
Value
=
"Red"
/>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
<!--
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"Foreground"
Value
=
"#FF151515"
/>
</
Style
>
<
Style
TargetType
=
"GroupBox"
>
<
Setter
Property
=
"Foreground"
Value
=
"#FF151515"
/>
</
Style
>
-->
</
ResourceDictionary
>
<
ResourceDictionary
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
>
<
Style
x:Key
=
"LinkButtonStyle"
TargetType
=
"{x:Type Button}"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"{x:Type Button}"
>
<
TextBlock
TextDecorations
=
"Underline"
>
<
ContentPresenter
/>
</
TextBlock
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"Foreground"
Value
=
"Blue"
/>
<
Setter
Property
=
"Cursor"
Value
=
"Hand"
/>
<
Style.Triggers
>
<
Trigger
Property
=
"IsMouseOver"
Value
=
"true"
>
<
Setter
Property
=
"Foreground"
Value
=
"Red"
/>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
</
ResourceDictionary
>
<
telerik:RadGridView
ItemsSource
=
"{Binding Object.Details.Attributes}"
AutoGenerateColumns
=
"True"
ScrollViewer.CanContentScroll
=
"True"
ScrollViewer.HorizontalScrollBarVisibility
=
"Visible"
ScrollViewer.VerticalScrollBarVisibility
=
"Visible"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
CanUserReorderColumns
=
"False"
CanUserResizeRows
=
"False"
CanUserFreezeColumns
=
"False"
CanUserSortColumns
=
"False"
IsFilteringAllowed
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ShowGroupPanel
=
"False"
DataLoadMode
=
"Asynchronous"
IsReadOnly
=
"{Binding IsEditing, Converter={StaticResource InvertBoolConverter}}"
EnableRowVirtualization
=
"True"
FrozenColumnCount
=
"1"
AllowDrop
=
"True"
behaviors:RowReorderBehavior.IsEnabled
=
"True"
BeginningEdit
=
"Attributes_RadGridView_BeginningEdit"
>
<
telerik:RadGridView.Resources
>
<
DataTemplate
x:Key
=
"DraggedItemTemplate"
>
<
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Dragging:"
/>
<
TextBlock
Text
=
"{Binding CurrentDraggedItem}"
FontWeight
=
"Bold"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding CurrentDropPosition}"
FontWeight
=
"Bold"
MinWidth
=
"45"
/>
<
TextBlock
Text
=
", ("
Foreground
=
"Gray"
/>
<
TextBlock
Text
=
"{Binding CurrentDraggedOverItem}"
/>
<
TextBlock
Text
=
")"
Foreground
=
"Gray"
/>
</
StackPanel
>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadGridView.Resources
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Attribute"
DataMemberBinding
=
"{Binding Attribute.TechName}"
IsReadOnly
=
"True"
/>
.......
<
telerik:GridViewDataColumn
Header
=
"Length"
DataMemberBinding
=
"{Binding Attribute.Details.LengthInternal}"
IsReadOnly
=
"True"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
But with this code, rows are displayed blank (only headers and scrollbars are visibles) :
<
telerik:RadGridView
ItemsSource
=
"{Binding Object.Details.Attributes}"
AutoGenerateColumns
=
"True"
ScrollViewer.CanContentScroll
=
"True"
ScrollViewer.HorizontalScrollBarVisibility
=
"Visible"
ScrollViewer.VerticalScrollBarVisibility
=
"Visible"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
CanUserReorderColumns
=
"False"
CanUserResizeRows
=
"False"
CanUserFreezeColumns
=
"False"
CanUserSortColumns
=
"False"
IsFilteringAllowed
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ShowGroupPanel
=
"False"
DataLoadMode
=
"Asynchronous"
IsReadOnly
=
"{Binding IsEditing, Converter={StaticResource InvertBoolConverter}}"
EnableRowVirtualization
=
"True"
FrozenColumnCount
=
"1"
AllowDrop
=
"True"
behaviors:RowReorderBehavior.IsEnabled
=
"True"
BeginningEdit
=
"Attributes_RadGridView_BeginningEdit"
>
<
telerik:RadGridView.Resources
>
<
DataTemplate
x:Key
=
"DraggedItemTemplate"
>
<
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Dragging:"
/>
<
TextBlock
Text
=
"{Binding CurrentDraggedItem}"
FontWeight
=
"Bold"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding CurrentDropPosition}"
FontWeight
=
"Bold"
MinWidth
=
"45"
/>
<
TextBlock
Text
=
", ("
Foreground
=
"Gray"
/>
<
TextBlock
Text
=
"{Binding CurrentDraggedOverItem}"
/>
<
TextBlock
Text
=
")"
Foreground
=
"Gray"
/>
</
StackPanel
>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadGridView.Resources
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Attribute"
DataMemberBinding
=
"{Binding Attribute.TechName}"
IsReadOnly
=
"True"
/>
.....
<
telerik:GridViewDataColumn
Header
=
"Length"
DataMemberBinding
=
"{Binding Attribute.Details.LengthInternal}"
IsReadOnly
=
"True"
/>
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView.RowStyle
>
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
<
Setter
Property
=
"telerik:DragDropManager.AllowDrag"
Value
=
"True"
/>
</
Style
>
</
telerik:RadGridView.RowStyle
>
</
telerik:RadGridView
>