This question is locked. New answers and comments are not allowed.
Hi Telerik,
Iam using TabControl , based on TabItem value I Need to Visible / Collapse The tabContent Controls Like Grid in my case .
For this Iam using I value Converter Class but this is not triggering in debugmode n not getting expected out put .
In Out Put window Iam getting bellow error "
"
Iam not understanding what is this error
My sample cosde bellow
Iam using TabControl , based on TabItem value I Need to Visible / Collapse The tabContent Controls Like Grid in my case .
For this Iam using I value Converter Class but this is not triggering in debugmode n not getting expected out put .
In Out Put window Iam getting bellow error "
"
System.Windows.Data Error: BindingExpression path error: 'Hide' property not found on 'MasterViewScreenDesignNavigation.Model.MasterModel' 'MasterViewScreenDesignNavigation.Model.MasterModel' (HashCode=35259143). BindingExpression: Path='Hide' DataItem='MasterViewScreenDesignNavigation.Model.MasterModel' (HashCode=35259143); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'Visibility' (type 'System.Windows.Visibility')..
"Iam not understanding what is this error
My sample cosde bellow
using System;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Ink;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using System.Collections.ObjectModel;using System.Collections.Generic;using MasterViewScreenDesignNavigation.Model;namespace MasterViewScreenDesignNavigation.VIewMOdel{ public class MasterViewModel: System.ComponentModel.INotifyPropertyChanged { MasterModel m = new MasterModel(); public MasterViewModel() { MAsterLIst = new ObservableCollection<MasterModel>(); MAsterLIst = m.GetAll(); Hide = false; } private ObservableCollection<MasterModel> _MAsterLIst ; public ObservableCollection<MasterModel> MAsterLIst { get { return _MAsterLIst; } set { _MAsterLIst = value; RaisePropertyChanged("MAsterLIst"); } } public MasterModel _ReportYear; public MasterModel SelectedReportYear { get { return _ReportYear; } set { _ReportYear = value; RaisePropertyChanged("SelectedReportYear"); if (SelectedReportYear.Year < 5) { Hide = true; } ValueHide(); } } public bool _Hide; public bool Hide { get { return _Hide; } set { _Hide = value; RaisePropertyChanged("Hide"); } } public void ValueHide() { } #region INotifyPropertyChanged Members public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); } #endregion }}public sealed class BooleanToVisibilityConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value is bool) { bool boolValue = (bool)value; return (boolValue == true) ? Visibility.Visible : Visibility.Collapsed; } return value; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); }<UserControl x:Class="MasterViewScreenDesignNavigation.MainPage" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:Con="clr-namespace:MasterViewScreenDesignNavigation.Common" xmlns:VM="clr-namespace:MasterViewScreenDesignNavigation.VIewMOdel" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <UserControl.Resources> <VM:MasterViewModel x:Key="vm" /> <Con:BooleanToVisibilityConverter x:Key="BoolVis"/> <DataTemplate x:Key="data" > <Grid > <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto" /> <RowDefinition Height="30" /> </Grid.RowDefinitions> <Grid > <TextBlock Text="{Binding Name}" Visibility="{Binding Hide, Converter={StaticResource BoolVis}}" /> </Grid> <Grid Grid.Row="1"> <TextBlock Text="{Binding Year}"/> </Grid> </Grid> </DataTemplate> </UserControl.Resources> <!--<UserControl.DataContext> <VM:MasterViewModel/> </UserControl.DataContext>--> <Grid x:Name="LayoutRoot" DataContext="{StaticResource vm}" > <Grid.Background> <ImageBrush ImageSource="/StrategyDevelopment;component/Images/Background.png" /> </Grid.Background> <Grid Grid.Row="1"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*"/> <RowDefinition Height="10" /> <RowDefinition Height="30" /> </Grid.RowDefinitions> <telerik:RadTabControl Grid.Row="0" ItemsSource="{Binding MAsterLIst,Mode=TwoWay}" DisplayMemberPath="Year" ContentTemplate="{StaticResource data}" SelectedItem="{Binding SelectedReportYear, Mode=TwoWay}"> </telerik:RadTabControl> </Grid> </Grid></UserControl>