Hello ,
i am using radtabcontrol , in which when initially control is loaded everything works fine, but if i change the datacontext when control is still active , the data is not loaded with in the tabs , but tabs are visible, once i click on the tab data is visible.
following screenshots may help
1. initial load when first time data is loaded.(intialload
2.when datacontext is changed(datacontextchanged)
3. when i click on any tab once data is loaded(afterclickingatab)
i want my ui to look like 3 when datacontext change happens , do you have any idea why this is happening ?
my xaml look like this -
i am using radtabcontrol , in which when initially control is loaded everything works fine, but if i change the datacontext when control is still active , the data is not loaded with in the tabs , but tabs are visible, once i click on the tab data is visible.
following screenshots may help
1. initial load when first time data is loaded.(intialload
2.when datacontext is changed(datacontextchanged)
3. when i click on any tab once data is loaded(afterclickingatab)
i want my ui to look like 3 when datacontext change happens , do you have any idea why this is happening ?
my xaml look like this -
<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; } } }