chri55w / QuickBooks-Timer

Savantech QuickBooks Timer - Issue Tracking / Wiki ONLY
3 stars 0 forks source link

Settings Flyout - XAML Code Improvement #20

Closed chri55w closed 8 years ago

chri55w commented 8 years ago

Move from current Grid row layout to a StackPanel to make it easier to add new settings in without re-ordering the Grid

chri55w commented 8 years ago

Changes to use new layout

<Grid> //4 rows ( Main / Footer)
    <StackPanel>
        //Full Line Setting
        <Grid>
            //Half Line Setting (Horizontal Align : Left)
            //Half Line Setting (Horizontal Align : Right)
        </Grid>
    <StackPanel>
    //Footer Items
</Grid>
chri55w commented 8 years ago

Changes applied and Snapshot of code included below, greatly improved process to add new settings items.

image

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition Height="12"/>
        <RowDefinition Height="7"/>
        <RowDefinition Height="15"/>
    </Grid.RowDefinitions>
    <StackPanel Margin="0" >
        <TextBlock Text="Folder Setup" VerticalAlignment="Center" Margin="10,5" FontSize="18" FontWeight="Bold" />
        <Separator Margin="10,2"/>
        <Grid Margin="10,1" ToolTip="Choose Where QuickBooks Timer Will Save All Data" >
            <TextBlock Text="Save Location:" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontStyle="Italic"/>
            <Button Height="28" HorizontalAlignment="Right" VerticalAlignment="Center" Width="83" Style="{DynamicResource FlatButtonStyle}">
                <Grid Width="54">
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="/QuickBooksTimer;component/Resources/Fonts/Custom QBTimer IconFont/#qbtimerfont" Text="&#xe805;" FontSize="18" Margin="0,1.5,0,0" />
                    <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Text="Browse" />
                </Grid>
            </Button>
        </Grid>
        <TextBlock Text="Style" VerticalAlignment="Center" Margin="10,25,10,10" FontSize="18" FontWeight="Bold" />
        <Separator Margin="10,2"/>
        <Grid Margin="10,1">
            <TextBlock Text="Theme: " VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontStyle="Italic"/>
            <ComboBox x:Name="CBTheme" VerticalAlignment="Center" HorizontalAlignment="Right" Width="180" Height="28" ItemsSource="{Binding AppThemes, Mode=OneWay}" SelectedItem="{Binding SelectedTheme, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemTemplate="{StaticResource ThemeComboboxTemplate}"/>
        </Grid>
        <Grid Margin="10,1">
            <TextBlock Text="Accent:" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontStyle="Italic" />
            <ComboBox x:Name="CBAccent" VerticalAlignment="Center" HorizontalAlignment="Right" Width="180" Height="28" ItemsSource="{Binding AccentColors, Mode=OneWay}" SelectedItem="{Binding SelectedAccent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemTemplate="{StaticResource AccentComboboxTemplate}"/>
        </Grid>
        <TextBlock Text="Taskbar Icon" VerticalAlignment="Center" Margin="10,25,10,10" FontSize="18" FontWeight="Bold" />
        <Separator Margin="10,0"/>
        <Grid Margin="10,5">
            <TextBlock Margin="10,0" Text="Max Recent Timers:" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontStyle="Italic" />
            <Grid HorizontalAlignment="Right" Width="180" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Slider Grid.Column="0" x:Name="SMaxRecentTimers" VerticalAlignment="Center" LargeChange="3" SmallChange="1" Value="{Binding Default.MaxShownRecentTimers, Mode=TwoWay, Source={StaticResource Settings}}" Minimum="0" Maximum="10" HorizontalContentAlignment="Center" ScrollViewer.VerticalScrollBarVisibility="Auto" IsSnapToTickEnabled="True"/>
                <TextBlock Grid.Column="1" Text="{Binding Value, ElementName=SMaxRecentTimers}" Width="20" TextAlignment="Right" VerticalAlignment="Center"/>
            </Grid>
        </Grid>
    </StackPanel>
    <TextBlock Grid.Row="1" Text="Note: All Settings Are Saved When This Flyout Closes." FontStyle="Italic" FontSize="10" Opacity="0.7" VerticalAlignment="Center" TextAlignment="Center"/>
    <Separator Grid.Row="2" Margin="4,0" />
    <TextBlock Grid.Row="3" Text="Click Here to Log an Issue or Suggestion via GitHub." FontSize="10" Opacity="0.7" VerticalAlignment="Top" TextAlignment="Center" >
            <ia:Interaction.Triggers>
                <ia:EventTrigger EventName="MouseLeftButtonUp">
                    <ia:InvokeCommandAction Command="{Binding LinkToGitHubIssuesCommand}"/>
                </ia:EventTrigger>
            </ia:Interaction.Triggers>
    </TextBlock>
</Grid>