feat: SegmentedControl 형태로 모니터링 필터버튼 추가

hhsung_work
HyungJune Kim 10 months ago
parent ea88b86186
commit 38458d2c30

@ -0,0 +1,31 @@
<UserControl x:Class="SmartAquaViewer.Controls.SegmentedControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SmartAquaViewer.Controls"
xmlns:helper="clr-namespace:SmartAquaViewer.Helper"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid>
<StackPanel Orientation="Horizontal">
<RadioButton Name="rdbtnA" Content="수조" GroupName="SignalType" Tag="Tank"
Checked="RadioButton_Checked"
Style="{StaticResource ImageRadioButtonStyle}" Width="250" Height="50" IsChecked="True"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/SegmentedControl/select_btn_1.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/SegmentedControl/select_btn_1_press.png"/>
<RadioButton Name="rdbtnB" Content="여과시스템" GroupName="SignalType" Tag="Filter"
Checked="RadioButton_Checked"
Style="{StaticResource ImageRadioButtonStyle}" Width="250" Height="50"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/SegmentedControl/select_btn_2.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/SegmentedControl/select_btn_2_press.png"/>
<RadioButton Name="rdbtnC" Content="살균시스템" GroupName="SignalType" Tag="Sterilizer"
Checked="RadioButton_Checked"
Style="{StaticResource ImageRadioButtonStyle}" Width="250" Height="50"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/SegmentedControl/select_btn_4.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/SegmentedControl/select_btn_4_press.png"/>
</StackPanel>
</Grid>
</Grid>
</UserControl>

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SmartAquaViewer.Controls
{
/// <summary>
/// SegmentedControl.xaml에 대한 상호 작용 논리
/// </summary>
public partial class SegmentedControl : UserControl
{
public SegmentedControl()
{
InitializeComponent();
}
public string SelectedValue
{
get { return (string)GetValue(SelectedValueProperty); }
set { SetValue(SelectedValueProperty, value); }
}
public static readonly DependencyProperty SelectedValueProperty =
DependencyProperty.Register(nameof(SelectedValue), typeof(string), typeof(SegmentedControl),
new PropertyMetadata(null));
private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
if (sender is RadioButton rb && rb.Tag != null)
{
SelectedValue = rb.Tag.ToString();
Debug.WriteLine($"SelectedValue changed to: {SelectedValue}");
}
}
}
}

@ -36,25 +36,25 @@
</Grid.ColumnDefinitions>
<RadioButton x:Name="rdbtnMonitoing" GroupName="contentSwap" Content="모니터링" Tag="monitoring"
Style="{StaticResource ImageRadioButtonStyle}" IsChecked="True"
Style="{StaticResource ImageRadioButtonStyle}" IsChecked="True" FontSize="30"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/tab_bg.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/tab_bg_off.png"
Command="{Binding SwapViewCommand}"
CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}"/>
<RadioButton x:Name="rdbtnEnergy" GroupName="contentSwap" Content="에너지" Tag="energy"
Style="{StaticResource ImageRadioButtonStyle}" Grid.Column="1"
Style="{StaticResource ImageRadioButtonStyle}" Grid.Column="1" FontSize="30"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/tab_bg.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/tab_bg_off.png"
Command="{Binding SwapViewCommand}"
CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}"/>
<RadioButton x:Name="rdBtnGreenHouseGas" GroupName="contentSwap" Content="온실가스" Tag="greenHouseGas"
Style="{StaticResource ImageRadioButtonStyle}" Grid.Column="2"
Style="{StaticResource ImageRadioButtonStyle}" Grid.Column="2" FontSize="30"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/tab_bg.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/tab_bg_off.png"
Command="{Binding SwapViewCommand}"
CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}"/>
<RadioButton x:Name="rdbtnCCTV" GroupName="contentSwap" Content="CCTV" Tag="cctv"
Style="{StaticResource ImageRadioButtonStyle}" Grid.Column="3"
Style="{StaticResource ImageRadioButtonStyle}" Grid.Column="3" FontSize="30"
helper:RadioButtonHelper.UnPressedImage="/Resources/Images/tab_bg.png"
helper:RadioButtonHelper.PressedImage="/Resources/Images/tab_bg_off.png"
Command="{Binding SwapViewCommand}"

@ -40,6 +40,7 @@
<Style x:Key="ImageRadioButtonStyle" TargetType="RadioButton">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
@ -48,7 +49,7 @@
Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(helper:RadioButtonHelper.UnPressedImage)}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"
TextElement.FontFamily="{StaticResource SCDream8}"
TextElement.FontSize="30"
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.Foreground="{TemplateBinding Foreground}"/>
</Grid>
<ControlTemplate.Triggers>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -22,6 +22,14 @@
<None Remove="Resources\Images\arrow_down.png" />
<None Remove="Resources\Images\arrow_up.png" />
<None Remove="Resources\Images\ListImage.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_1.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_1_press.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_2.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_2_press.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_3.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_3_press.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_4.png" />
<None Remove="Resources\Images\SegmentedControl\select_btn_4_press.png" />
<None Remove="Resources\Images\tab_bg.png" />
<None Remove="Resources\Images\tab_bg_off.png" />
<None Remove="Resources\Images\top_bg.png" />
@ -30,6 +38,12 @@
<ItemGroup>
<PackageReference Include="MaterialDesignColors" Version="5.2.1" />
<PackageReference Include="MaterialDesignThemes" Version="5.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
@ -46,6 +60,14 @@
<Resource Include="Resources\Images\arrow_down.png" />
<Resource Include="Resources\Images\arrow_up.png" />
<Resource Include="Resources\Images\ListImage.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_1.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_1_press.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_2.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_2_press.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_3.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_3_press.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_4.png" />
<Resource Include="Resources\Images\SegmentedControl\select_btn_4_press.png" />
<Resource Include="Resources\Images\tab_bg.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>

@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SmartAquaViewer.View"
xmlns:control="clr-namespace:SmartAquaViewer.Controls"
xmlns:helper="clr-namespace:SmartAquaViewer.Helper"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
@ -19,6 +20,8 @@
<Grid.Background>
<ImageBrush ImageSource="/Resources/Images/top_bg.png" Stretch="Fill"/>
</Grid.Background>
<control:SegmentedControl x:Name="segmentedControl" Margin="10 10"
SelectedValue="{Binding CurrentSystem, Mode=TwoWay}"/>
</Grid>
<Grid Grid.Row="1" VerticalAlignment="Bottom">

Loading…
Cancel
Save