Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="WPFWeather.Windows.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:WPFWeather"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
- xmlns:converters="clr-namespace:WPFWeather.Converters"
- xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:command="http://www.galasoft.ch/mvvmlight"
- xmlns:viewModels="clr-namespace:WPFWeather.ViewModels"
- Title="WPF Weather Demo" Height="500" Width="300"
- d:DataContext="{}">
- <Window.Resources>
- <converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
- </Window.Resources>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="50" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="50" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="80" />
- <RowDefinition Height="50" />
- <RowDefinition Height="50" />
- <RowDefinition Height="50" />
- <RowDefinition Height="50" />
- <RowDefinition Height="*" />
- <RowDefinition Height="50" />
- </Grid.RowDefinitions>
- <!-- Your stuff here -->
- <Image Source="{Binding Weather.Icon}" Grid.Row="0" Grid.Column="1"/>
- <ComboBox Name="comboBox" SelectedValuePath="Name" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Margin="10">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="Loaded">
- <command:EventToCommand Command="{Binding DownloadWeatherCommand}"
- CommandParameter="{Binding ElementName=comboBox, Path=SelectedValue}"/>
- </i:EventTrigger>
- <i:EventTrigger EventName="SelectionChanged">
- <command:EventToCommand Command="{Binding DownloadWeatherCommand}"
- CommandParameter="{Binding ElementName=comboBox, Path=SelectedValue}"/>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- <ComboBoxItem Name="brno">Brno</ComboBoxItem>
- <ComboBoxItem Name="praha">Praha</ComboBoxItem>
- <ComboBoxItem Name="london">Londýn</ComboBoxItem>
- </ComboBox>
- <TextBlock Text="{Binding Weather.Temperature, StringFormat='{}{0:0}°C'}" Grid.Row="2" Grid.Column="1"/>
- <TextBlock Text="{Binding Weather.Humidity, StringFormat='{}Humidity: {0}%'}" Grid.Row="3" Grid.Column="1"/>
- <TextBlock Text="{Binding Weather.WindSpeed, StringFormat='{}Wind speed: {0} m/s'}" Grid.Row="4" Grid.Column="1"/>
- <Polygon Width="31" Height="31" Fill="Black" Grid.Row="4" Grid.Column="2">
- <Polygon.LayoutTransform>
- <RotateTransform Angle="{Binding Weather.WindDirection}"/>
- </Polygon.LayoutTransform>
- <Polygon.Points>
- <Point X="15" Y="0" />
- <Point X="10" Y="30" />
- <Point X="20" Y="30" />
- </Polygon.Points>
- </Polygon>
- </Grid>
- </Window>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement