Toggle Button Style

3 posts, 0 answers
  1. Lee
    Lee avatar
    30 posts
    Member since:
    Apr 2014

    Posted 08 Aug 2014 Link to this post

    Hi.

    I want to use toggle button.

    Button design is attached in file.

    I try to find, but I don't find that.

    Is it apply that?
  2. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 11 Aug 2014 Link to this post

    Hello Lee,

    I looked at the picture you attached and I am not sure which one of the designs you want to implement. However you can modify the look of the RadToggleButton using a one of the following approaches:
    1) You could you use a custom style for the RadToggleButton and reuse some of the VisualStates that you want to keep.
    2) Another approach is to directly use the Content property of the Button and do the logic there, here is an example how you can do that:
    <Window.Resources>
        <telerik:BooleanToOpacityConverter x:Key="converter" />
        <telerik:InvertedBooleanToOpacityConverter x:Key="invertedConverter" />
    </Window.Resources>
    <Grid>
        <telerik:RadToggleButton Width="200" Height="100" x:Name="xToggle">
            <StackPanel Orientation="Horizontal" Height="100" >
                <Grid Background="Red" Width="100" Opacity="{Binding ElementName=xToggle, Path=IsChecked ,Converter={StaticResource invertedConverter}}">
                    <TextBlock Text="On" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Grid>
                <Grid Background="Blue" Grid.Column="1" Width="100" Opacity="{Binding ElementName=xToggle, Path=IsChecked ,Converter={StaticResource converter}}">
                    <TextBlock Text="Off" HorizontalAlignment="Center" VerticalAlignment="Center"  />
                </Grid>
            </StackPanel>
        </telerik:RadToggleButton>
    </Grid>

    I hope this information helps.

    Kind regards,
    Kiril Vandov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Lee
    Lee avatar
    30 posts
    Member since:
    Apr 2014

    Posted 11 Aug 2014 in reply to Kiril Vandov Link to this post

    Thank you for your answer.

    I think that example is utilized.

    Thank you
Back to Top