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>
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
Without a path, {Binding} will bind to the DataContext itself. Adding a path will bind to a property of the datacontext.
Underlining text can be done either with <Underline>…</Underline> or with the TextDecorations attribute set to Underline. You can include the latter in a style definition: <Style x:Key=”Underlined”> <Setter Property=”TextBlock.TextDecorations” Value=”Underline” /> </Style> <TextBlock Style=”{StaticResource Underlined}”> Foo </TextBlock>
You need to put the content (the grid) inside a Viewbox and set the Viewbox.Stretch Property to Stretch.Uniform The Viewbox control is used to stretch or scale a child element and lets you control the way the child is stretched. Check the examples here. (source: microsoft.com)
First of all you can’t bind to variable. You can bind only to properties from XAML. For binding to static property you can do in this way (say you want to bind Text property of TextBlock) – <TextBlock Text=”{Binding Source={x:Static local:YourClassName.PropertyName}}”/> where local is namespace where your class resides which you need to declare above … Read more
You can set RenderTransformOrigin to “0.5, 0.5″ <Style x:Key=”sizeButton” TargetType=”Button”> <Setter Property=”RenderTransformOrigin” Value=”0.5, 0.5″/> <Style.Triggers> <Trigger Property=”IsMouseOver” Value=”True”> <Setter Property=”RenderTransform”> <Setter.Value> <ScaleTransform ScaleX=”1.5″ ScaleY=”1.5″/> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style>
All good answers that has been supplied, but I used the following to solve my problem <ComboBox SelectedIndex=”0″> <ComboBox.ItemsSource> <CompositeCollection> <ListBoxItem>Please Select</ListBoxItem> <CollectionContainer Collection=”{Binding Source={StaticResource YOURDATASOURCE}}” /> </CompositeCollection> </ComboBox.ItemsSource> </ComboBox> Thanks for everyone who has helped!
The problem is that the ContextMenu it not in the visual tree, so you basically have to tell the Context menu about which data context to use. Check out this blogpost with a very nice solution of Thomas Levesque. He creates a class Proxy that inherits Freezable and declares a Data dependency property. public class … Read more
This works: <TextBox Text=”{Binding Source={StaticResource myStatic}, Converter={StaticResource myConverter}, Mode=OneWay}” /> Note that you have to bind one way, because the binding requires a path attribute otherwise. This makes sense, as otherwise the binding would have to replace the whole resource…