Search This Blog

Wednesday, November 4, 2015

Label WPF Example

WPF > Controls  > ContentControl > Label

This control represents the text label for a control and provides support for access keys.

Example

The following example shows how to create a Label that has an access key and uses a binding to set the target.

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TextBox Name="textBox" Margin="49,0,281,291"/>
        <Label Target="{Binding ElementName=textBox}">_Name</Label>
    </Grid>

</Window>

Tuesday, November 3, 2015

RadGridView WPF disable cell or row

WPF > RadGridView > Disable

<Style x:Key="disabledCell" TargetType="telerik:GridViewCell">
<Setter Property="IsEnabled" Value="False"/>
</Style>

<telerik:GridViewDataColumn 
        DataMemberBinding="{Binding Name}"
        CellStyle="{StaticResource disabledCell}"
/>


To disable all the rows you need to apply a Style targeting the GridViewRow element.

<Style TargetType="telerik:GridViewRow">
       <Setter Property="IsEnabled" Value="False"/>
</Style>