KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have spent all day looking for a way to display a default string of text on a ComboBox and the closest I managed to find that worked was an example that uses watermarking. When my application opens, the ComboBox 's Visibility property is set to Collapsed and then made visible by a command. Unfortunately, I can't get the watermark to follow suit. Here is what I'm working with: <Style x:Key="watermarkLabelStyle"> <Setter Property="TextBlock.Foreground" Value="Black" /> <Setter Property="FrameworkElement.Opacity" Value="0.8" /> <Setter Property="TextBlock.FontSize" Value="12" /> <Setter Property="TextBlock.FontStyle" Value="Italic" /> <Setter Property="TextBlock.Margin" Value="8,4,4,4" /> <Setter Property="TextBlock.Visibility" Value="{Binding Visible}" /> </Style> {Binding Visible} has no effect even though other controls in the window are bound to it and behave properly. <ComboBox ItemsSource="{Binding LeagueFormatsNode}" x:Name="leagueFormatComboBox" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" ScrollViewer.CanContentScroll="False" HorizontalContentAlignment="Stretch" Visibility="{Binding Visible}" Behaviors:WatermarkComboBoxBehavior.EnableWatermark="True" Behaviors:WatermarkComboBoxBehavior.Label="Select League Format" Behaviors:WatermarkComboBoxBehavior.LabelStyle="{StaticResource watermarkLabelStyle}" /> And the Visible property in the viewmodel: public Visibility Visible { get { return _visibile; } set { if (_visibile == value) return; _visibile = value; RaisePropertyChanged(() => Visible); } } What can I do to make the setter in the style behave and register the binding?</
Tags (comma-separated)
Save Edits
Cancel