Skip to content

MichaelPuckett2/SpeckyUWP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpeckyUWP

Reactive model package to help develop MVVM / reactive oriented models.

Example of using VisualStateCommand - No code behind required.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="DialogGroup">
            <VisualState x:Name="ShowDialogState">
                <VisualState.Setters>
                    <Setter Target="textBlock.Visibility"
                            Value="Visible" />
                </VisualState.Setters>
            </VisualState>
            <VisualState x:Name="HideDialogState">
                <VisualState.Setters>
                    <Setter Target="textBlock.Visibility"
                            Value="Collapsed" />
                </VisualState.Setters>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Grid Name="textBlock"
                Visibility="Collapsed"
          Width="300"
          Height="120">
        <Rectangle Fill="Red" />
        <TextBlock Text="{Binding (SpeckyInteraction:VisualStateCommand.DataContext), ElementName=page}"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center" />
    </Grid>

    <StackPanel VerticalAlignment="Center">
        <Button Content="Show Dialog 1"
                SpeckyInteraction:VisualStateCommand.StateControl="page"
                SpeckyInteraction:VisualStateCommand.VisualState="ShowDialogState"
                SpeckyInteraction:VisualStateCommand.DataContext="Button 1"/>

        <Button Content="Show Dialog 2"
                SpeckyInteraction:VisualStateCommand.StateControl="page"
                SpeckyInteraction:VisualStateCommand.VisualState="ShowDialogState"
                SpeckyInteraction:VisualStateCommand.DataContext="Button 2" />

        <Button Content="Close Dialog"
                SpeckyInteraction:VisualStateCommand.StateControl="page"
                SpeckyInteraction:VisualStateCommand.VisualState="HideDialogState" />

        <CheckBox Content="Show or Hide"
                  SpeckyInteraction:VisualStateCommand.StateControl="page"
                  SpeckyInteraction:VisualStateCommand.CheckedVisualState="ShowDialogState"
                  SpeckyInteraction:VisualStateCommand.NotCheckedVisualState="HideDialogState"
                  SpeckyInteraction:VisualStateCommand.DataContext="CheckBox" />
    </StackPanel>

</Grid>

About

Reactive model package to help develop MVVM / reactive oriented models.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages