How to set background opacity and border opacity in XAML?
You want to do something like this: <TextBlock Text=”foo bar”> <TextBlock.Background> <SolidColorBrush Color=”Azure” Opacity=”0.5″ /> </TextBlock.Background> </TextBlock>
You want to do something like this: <TextBlock Text=”foo bar”> <TextBlock.Background> <SolidColorBrush Color=”Azure” Opacity=”0.5″ /> </TextBlock.Background> </TextBlock>
You can specify the visibility of the scrollbar for both vertical and horizontal scrolling to four options, using the ScrollViewer.HorizontalScrollBarVisibility and ScrollViewer.VerticalScrollBarVisibility attached properties: Auto, Disabled, Hidden and Visible. <ListView ScrollViewer.HorizontalScrollBarVisibility=”Disabled”> Disabled will have it never show up and scrolling is not possible, Hidden will have it not show, but will allow users to scroll … Read more
I believe that your MouseLeftButtonDown handler is not called because the ListBox uses this event internally to fire its SelectionChanged event (with the thought being that in the vast majority of cases, SelectionChanged is all you need). That said, you have a couple of options. First, you could subscribe to the PreviewLeftButtonDown event instead. Most … Read more
No need for attached behaviors or custom DataGrid subclasses here. In your DataGrid, bind ItemsSource to an ICollectionView. The trick here is to set IsSynchronizedWithCurrentItem=”True” which means the selected row will be the current item. The second part of the trick is to bind CommandParameter to the current item with the forward slash syntax. When … Read more
Multibinding requires a converter for all but the rarest circumstances (using StringFormat). MultiTrigger only requires a converter to get your binding results into booleans.
Template property defines the appearence of a Control itself and ContentTemplate defines the template of the Content area of a Control. Interesting point from MSDN: If a Control does not have a ControlTemplate, the Control will not appear in your application. This becomes more clear when we take a look at the data types of … Read more
This is a very interesting question and one that I don’t feel has a definitive answer, but I’ll do my best to throw my thoughts out there. Looking at the MVVM pattern as I understand it, the point of the ViewModel is to expose the data in a way the View can understand without any … Read more
The prompts should definitely not be part of the ViewModel, but this doesn’t necessarily mean that the best solution is to hardcode them in the View (even though that’s a very reasonable first approach). There are two alternatives that I know of which can reduce coupling between View and ViewModel: using an interaction service, and … Read more
Without a path, {Binding} will bind to the DataContext itself. Adding a path will bind to a property of the datacontext.
Try this <Window.Resources> //Put this resourse n Window.Resources or UserControl.Resources <LinearGradientBrush x:Key=”NormalBrush” StartPoint=”0,0″ EndPoint=”0,1″> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color=”#FFDC3939″ Offset=”0.0″/> <GradientStop Color=”#FFE80E0E” Offset=”1.0″/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> <SolidColorBrush x:Key=”WindowBackgroundBrush” Color=”#FFFBE618″ /> <ControlTemplate x:Key=”ComboBoxToggleButton” TargetType=”ToggleButton”> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width=”20″ /> </Grid.ColumnDefinitions> <Border x:Name=”Border” Grid.ColumnSpan=”2″ CornerRadius=”2″ Background=”{StaticResource NormalBrush}” BorderThickness=”1″ /> <Border Grid.Column=”0″ CornerRadius=”2,0,0,2″ Margin=”1″ Background=”{StaticResource WindowBackgroundBrush}” BorderThickness=”0,0,1,0″ … Read more