ListBoxEdit

De Banane Atomic
Révision datée du 16 novembre 2015 à 13:42 par Nicolas (discussion | contributions) (→‎Style RadioButton)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigationAller à la recherche

Style RadioButton

Xaml.svg
<!-- xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
     Assembly: DevExpress.Xpf.Core.v15.1.dll -->
<dxe:ListBoxEdit ItemsSource="{Binding Path=...}" SelectedIndex="{Binding Path=...}"
                 Background="Transparent" VerticalContentAlignment="Top">

    <dxe:ListBoxEdit.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </dxe:ListBoxEdit.ItemsPanel>

    <dxe:ListBoxEdit.Items>
        <dxe:ListBoxEditItem Content="Item1"/>
        <dxe:ListBoxEditItem Content="Item2" />
    </dxe:ListBoxEdit.Items>

    <!-- Style RadioButton -->
    <dxe:ListBoxEdit.StyleSettings>
        <dxe:RadioListBoxEditStyleSettings/>
    </dxe:ListBoxEdit.StyleSettings>
    <dxe:ListBoxEdit.ItemContainerStyle>
        <Style>
            <Setter Property="Control.Margin" Value="3 0" />
        </Style>
    </dxe:ListBoxEdit.ItemContainerStyle>

    <!-- Style Masquer la bordure -->
    <dxe:ListBoxEdit.BorderTemplate>
        <ControlTemplate TargetType="{x:Type ContentControl}">
            <Border Width="Auto" Height="Auto" BorderThickness="1" SnapsToDevicePixels="True">
                <ContentPresenter />
            </Border>
        </ControlTemplate>
    </dxe:ListBoxEdit.BorderTemplate>
</dxe:ListBoxEdit>
Le binding de RadioButton est plus facile avec ListBoxEdit et RadioListBoxEditStyleSettings.