Skip to content

Commit

Permalink
Add horizontal layout option
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers committed Dec 7, 2017
1 parent 672bc8b commit b1e3263
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Network Monitor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
</setting>
<setting name="Placement" serializeAs="Xml">
<value>
<WindowPlacement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<WindowPlacement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Length>0</Length>
<Flags/>
<Flags />
<ShowCommand>Hide</ShowCommand>
<MinimizedPosition>
<X>0</X>
Expand All @@ -51,6 +52,9 @@
<setting name="Bits" serializeAs="String">
<value>True</value>
</setting>
<setting name="Horizontal" serializeAs="String">
<value>False</value>
</setting>
</Network_Monitor.Properties.Settings>
</userSettings>
<applicationSettings>
Expand Down
24 changes: 24 additions & 0 deletions Network Monitor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
IsCheckable="True"
IsChecked="{Binding ShowInTaskbar, Source={x:Static p:Settings.Default}, Mode=TwoWay}" />

<MenuItem Header="_Horizontal layout"
IsCheckable="True"
IsChecked="{Binding Horizontal, Source={x:Static p:Settings.Default}, Mode=TwoWay}" />

<MenuItem>
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
Expand Down Expand Up @@ -83,6 +87,26 @@
</Grid.Resources>

<ItemsControl ItemsSource="{Binding Monitors}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel>
<StackPanel.Style>
<Style TargetType="StackPanel">
<Setter Property="Orientation"
Value="Vertical" />
<Style.Triggers>
<DataTrigger Binding="{Binding Horizontal, Source={x:Static p:Settings.Default}, Mode=OneWay}"
Value="True">
<Setter Property="Orientation"
Value="Horizontal" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>

<ItemsControl.ItemTemplate>
<DataTemplate>
<root:MonitorView Width="{Binding ActualWidth, ElementName=DummyMonitor}" />
Expand Down
12 changes: 12 additions & 0 deletions Network Monitor/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Network Monitor/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@
<Setting Name="Timeout" Type="System.TimeSpan" Scope="Application">
<Value Profile="(Default)">00:00:04</Value>
</Setting>
<Setting Name="Horizontal" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

0 comments on commit b1e3263

Please sign in to comment.