Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ModelObject DataContextModel = new ModelObject()
- {
- Minutes = 0,
- Hour = 0
- };
- ...
- this.DataContext = DataContextModel
- public class ModelObject : INotifyPropertyChanged
- {
- ...
- bool LiveScrapingValue = true;
- public bool LiveScraping
- {
- get { return LiveScrapingValue; }
- set
- {
- LiveScrapingValue = value;
- }
- }
- ...
- <TabControl Name="ScraperLiveAttorneysTabControl" Visibility="{Binding LiveScraping, Converter={StaticResource boolToVisibilityConverter}}">
- public class BooleanToVisibilityConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (!(value is bool))
- {
- if ((bool)value == true)
- {
- return Visibility.Hidden;
- }
- else
- {
- return Visibility.Visible;
- }
- }
- return Visibility.Hidden;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- <Controls:MetroWindow.Resources>
- <local:BooleanToVisibilityConverter x:Key="boolToVisibilityConverter"/>
- </Controls:MetroWindow.Resources>
- DataContextModel.LiveScraping = true;
Add Comment
Please, Sign In to add comment