SHARE
TWEET

Untitled

a guest Nov 12th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <Window x:Class="WPFWeather.Windows.MainWindow"
  2.         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.         xmlns:local="clr-namespace:WPFWeather"
  5.         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6.         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  7.         mc:Ignorable="d"
  8.         xmlns:converters="clr-namespace:WPFWeather.Converters"
  9.         xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  10.         xmlns:command="http://www.galasoft.ch/mvvmlight"
  11.         xmlns:viewModels="clr-namespace:WPFWeather.ViewModels"
  12.         Title="WPF Weather Demo" Height="500" Width="300"
  13.         d:DataContext="{}">
  14.  
  15.     <Window.Resources>
  16.         <converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
  17.     </Window.Resources>
  18.  
  19.   <Grid>
  20.   <Grid.ColumnDefinitions>
  21.       <ColumnDefinition Width="50" />
  22.       <ColumnDefinition Width="*" />
  23.       <ColumnDefinition Width="50" />
  24.   </Grid.ColumnDefinitions>
  25.   <Grid.RowDefinitions>
  26.       <RowDefinition Height="80" />
  27.       <RowDefinition Height="50" />
  28.       <RowDefinition Height="50" />
  29.       <RowDefinition Height="50" />
  30.       <RowDefinition Height="50" />
  31.       <RowDefinition Height="*" />
  32.       <RowDefinition Height="50" />
  33.   </Grid.RowDefinitions>
  34.  
  35.     <!-- Your stuff here -->
  36.  
  37.    
  38.     <Image Source="{Binding Weather.Icon}" Grid.Row="0" Grid.Column="1"/>
  39.    
  40.     <ComboBox Name="comboBox" SelectedValuePath="Name" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Margin="10">
  41.       <i:Interaction.Triggers>
  42.         <i:EventTrigger EventName="Loaded">
  43.           <command:EventToCommand Command="{Binding DownloadWeatherCommand}"
  44.               CommandParameter="{Binding ElementName=comboBox, Path=SelectedValue}"/>
  45.         </i:EventTrigger>
  46.         <i:EventTrigger EventName="SelectionChanged">
  47.           <command:EventToCommand Command="{Binding DownloadWeatherCommand}"
  48.               CommandParameter="{Binding ElementName=comboBox, Path=SelectedValue}"/>
  49.         </i:EventTrigger>
  50.       </i:Interaction.Triggers>
  51.  
  52.       <ComboBoxItem Name="brno">Brno</ComboBoxItem>
  53.       <ComboBoxItem Name="praha">Praha</ComboBoxItem>
  54.       <ComboBoxItem Name="london">Londýn</ComboBoxItem>
  55.     </ComboBox>
  56.  
  57.     <TextBlock Text="{Binding Weather.Temperature, StringFormat='{}{0:0}°C'}" Grid.Row="2" Grid.Column="1"/>
  58.  
  59.     <TextBlock Text="{Binding Weather.Humidity, StringFormat='{}Humidity: {0}%'}" Grid.Row="3" Grid.Column="1"/>
  60.  
  61.     <TextBlock Text="{Binding Weather.WindSpeed, StringFormat='{}Wind speed: {0} m/s'}" Grid.Row="4" Grid.Column="1"/>
  62.    
  63.    
  64.     <Polygon Width="31" Height="31" Fill="Black" Grid.Row="4" Grid.Column="2">
  65.       <Polygon.LayoutTransform>
  66.         <RotateTransform Angle="{Binding Weather.WindDirection}"/>
  67.       </Polygon.LayoutTransform>
  68.       <Polygon.Points>
  69.         <Point X="15" Y="0" />
  70.         <Point X="10" Y="30" />
  71.         <Point X="20" Y="30" />
  72.       </Polygon.Points>
  73.     </Polygon>
  74.  
  75.   </Grid>
  76.  
  77. </Window>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top