Skip to content

Commit

Permalink
Replace ViewLocator with CompileBindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Coding-Enthusiast committed May 2, 2024
1 parent 22ef443 commit 8a6c914
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 15 deletions.
35 changes: 29 additions & 6 deletions Src/Denovo/App.axaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Denovo"
xmlns:vm="clr-namespace:Denovo.ViewModels"
xmlns:views="clr-namespace:Denovo.Views"
x:Class="Denovo.App"
RequestedThemeVariant="Default">

<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
RequestedThemeVariant="Default">

<Application.Styles>
<SimpleTheme/>
<SimpleTheme/>
</Application.Styles>

<Application.DataTemplates>
<DataTemplate DataType="{x:Type vm:AboutViewModel}">
<views:AboutView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:ConfigurationViewModel}">
<views:ConfigurationView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:EciesViewModel}">
<views:EciesView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:MinerViewModel}">
<views:MinerView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:PushTxViewModel}">
<views:PushTxView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:VerifyTxViewModel}">
<views:VerifyTxView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:WifHelperViewModel}">
<views:WifHelperView/>
</DataTemplate>
</Application.DataTemplates>


<Application.Styles>
<Style Selector="Button">
<Setter Property="MinHeight" Value="35"/>
Expand Down
1 change: 1 addition & 0 deletions Src/Denovo/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Denovo
{
[Obsolete]
public class ViewLocator : IDataTemplate
{
public bool SupportsRecycling => false;
Expand Down
2 changes: 2 additions & 0 deletions Src/Denovo/Views/AboutView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:CompileBindings="True"
x:DataType="vm:AboutViewModel"
x:Class="Denovo.Views.AboutView"
FontFamily="Comic Sans MS" FontSize="16">

Expand Down
4 changes: 3 additions & 1 deletion Src/Denovo/Views/ConfigurationView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="600"
x:CompileBindings="True"
x:DataType="vm:ConfigurationViewModel"
x:Class="Denovo.Views.ConfigurationView"
FontSize="16">
FontSize="14">

<Design.DataContext>
<vm:ConfigurationViewModel/>
Expand Down
2 changes: 2 additions & 0 deletions Src/Denovo/Views/EciesView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:CompileBindings="True"
x:DataType="vm:EciesViewModel"
x:Class="Denovo.Views.EciesView"
FontSize="14">

Expand Down
11 changes: 6 additions & 5 deletions Src/Denovo/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
x:CompileBindings="True"
x:DataType="vm:MainWindowViewModel"
x:Class="Denovo.Views.MainWindow"
FontSize="14"
Height="690"
Width="700"
Height="690" Width="700"
Title="MainWindow">

<Design.DataContext>
Expand Down Expand Up @@ -59,7 +60,7 @@
</StackPanel>
<TextBlock Text="{Binding NodeStatus.StartHeight}"/>
<TextBlock Text="{Binding NodeStatus.UserAgent}"/>
<TextBlock Text="{Binding NodeStatus.Violation}"/>
<!--<TextBlock Text="{Binding NodeStatus.Violation}"/>-->
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
Expand All @@ -73,8 +74,8 @@
</Grid>

<Grid ColumnDefinitions="200,*" Background="GhostWhite" Margin="0,5,0,0" Grid.Row="2">
<TextBlock Text="{Binding State}" Margin="3" Grid.Column="0"/>
<ProgressBar Value="{Binding Progress}" Margin="3" Grid.Column="1"/>
<!--<TextBlock Text="{Binding State}" Margin="3" Grid.Column="0"/>-->
<!--<ProgressBar Value="{Binding Progress}" Margin="3" Grid.Column="1"/>-->
</Grid>
</Grid>
</Window>
5 changes: 4 additions & 1 deletion Src/Denovo/Views/MinerView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Denovo.Views.MinerView">
x:CompileBindings="True"
x:DataType="vm:MinerViewModel"
x:Class="Denovo.Views.MinerView"
FontSize="14">

<Design.DataContext>
<vm:MinerViewModel/>
Expand Down
5 changes: 4 additions & 1 deletion Src/Denovo/Views/PushTxView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
mc:Ignorable="d" d:DesignWidth="650" d:DesignHeight="450"
x:Class="Denovo.Views.PushTxView">
x:CompileBindings="True"
x:DataType="vm:PushTxViewModel"
x:Class="Denovo.Views.PushTxView"
FontSize="14">

<Design.DataContext>
<vm:PushTxViewModel/>
Expand Down
5 changes: 4 additions & 1 deletion Src/Denovo/Views/VerifyTxView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
xmlns:models="clr-namespace:Denovo.Models;assembly=Denovo"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="550"
x:CompileBindings="True"
x:DataType="vm:VerifyTxViewModel"
x:Class="Denovo.Views.VerifyTxView"
FontSize="14">

Expand Down Expand Up @@ -46,7 +49,7 @@
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="models:UtxoModel">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding TxId}"
TextWrapping="NoWrap"
Expand Down
2 changes: 2 additions & 0 deletions Src/Denovo/Views/WifHelperView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Denovo.ViewModels;assembly=Denovo"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:CompileBindings="True"
x:DataType="vm:WifHelperViewModel"
x:Class="Denovo.Views.WifHelperView"
FontSize="14">

Expand Down

0 comments on commit 8a6c914

Please sign in to comment.