Here's an improved version of OptionDialogView.xaml for your consideration. Changes are slightly larger dialog box, resizeable window, MouseOver background coloring for TreeViewItems, better(?) sizing of content box, better margining, fewer attributes, more maintainable.

<Window x:Class="SoapBox.Core.Options.OptionsDialogView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:res="clr-namespace:SoapBox.Core.Options"
xmlns:local="clr-namespace:SoapBox.Core.Options"
xmlns:contracts="clr-namespace:SoapBox.Core;assembly=SoapBox.Core.Contracts"
Title="{x:Static res:Resources.Strings.OptionsDialog_Title}" 
Height="520" Width="730" 
WindowStyle="SingleBorderWindow" 
WindowStartupLocation="CenterOwner"
ResizeMode="CanResize">

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <!-- Tree -->
    <TreeView Margin="12,12,12,0" Name="tvMenu"
              ItemsSource="{Binding Path=(contracts:IOptionsItem.Items)}">
        <TreeView.ItemContainerStyle>
            <Style>
                <Setter Property="TreeViewItem.Header" Value="{Binding Path=(contracts:IOptionsItem.Header)}"/>
                <Setter Property="TreeViewItem.ItemsSource" Value="{Binding Path=(contracts:IOptionsItem.Items)}"/>
                <Setter Property="TreeViewItem.Margin" Value="0,2,16,2"/>
                <Style.Triggers>
                    <Trigger Property="TreeViewItem.IsMouseOver" Value="True" >
                        <Setter Property="TreeViewItem.Background" Value="WhiteSmoke" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </TreeView.ItemContainerStyle>
    </TreeView>

    <StackPanel Grid.Row="1" Grid.Column="1" Margin="4" Orientation="Horizontal" FlowDirection="RightToLeft">
        <!-- Ok and Cancel -->
        <Button IsCancel="True" Width="120" Height="30" Margin="0,0,8,0"
            Command="{Binding CancelButton}" Click="Cancel_Click">
            <TextBlock Text="{x:Static res:Resources.Strings.OptionsDialog_Cancel}" />
        </Button>
        <Button IsDefault="True" Width="120" Height="30" Margin="0,0,8,0"
            Command="{Binding OKButton}" Click="OK_Click">
            <TextBlock Text="{x:Static res:Resources.Strings.OptionsDialog_OK}" />
        </Button>
    </StackPanel>

    <!-- Content -->
    <ContentControl Grid.Row="0" Grid.Column="1" Name="mainContent" Content="{Binding ElementName=tvMenu, Path=SelectedItem.Pad}" />
</Grid>
</Window>

asked 11 Sep '10, 17:04

BSalita's gravatar image

BSalita
276131417
accept rate: 22%

edited 11 Sep '10, 20:31

Scott%20Whitlock's gravatar image

Scott Whitlock ♦♦
696262833

Thanks for posting this!

(11 Sep '10, 17:49) Scott Whitlock ♦♦
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17
×11
×6
×2
×2
×1
×1

Asked: 11 Sep '10, 17:04

Seen: 1,231 times

Last updated: 11 Sep '10, 20:31

powered by OSQA