-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from AvaloniaCommunity/dev
v2.5.0
- Loading branch information
Showing
23 changed files
with
465 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Material.Demo.Models { | ||
public class Sample2Model { | ||
public Sample2Model(int number) { | ||
Number = number; | ||
} | ||
public int Number { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,131 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles" | ||
xmlns:viewModels="clr-namespace:Material.Demo.ViewModels" | ||
x:Class="Material.Demo.Pages.DialogDemo" | ||
x:DataType="viewModels:DialogDemoViewModel"> | ||
<StackPanel Margin="16, 0"> | ||
<TextBlock Classes="Headline4 Subheadline" Text="Dialogs"/> | ||
|
||
<WrapPanel> | ||
<WrapPanel.Styles> | ||
<Style Selector="WrapPanel > StackPanel, | ||
WrapPanel > Grid"> | ||
<Setter Property="Width" Value="300"/> | ||
<Setter Property="MinHeight" Value="300"/> | ||
</Style> | ||
<Style Selector="WrapPanel > StackPanel > StackPanel, | ||
WrapPanel > Grid > StackPanel"> | ||
<Setter Property="HorizontalAlignment" Value="Center"/> | ||
<Setter Property="VerticalAlignment" Value="Center"/> | ||
<Setter Property="Margin" Value="8"/> | ||
</Style> | ||
<Style Selector="WrapPanel > Grid > StackPanel > StackPanel, | ||
WrapPanel > StackPanel > StackPanel > StackPanel"> | ||
<Setter Property="Margin" Value="8"/> | ||
</Style> | ||
</WrapPanel.Styles> | ||
<Grid> | ||
<TextBlock Classes="Headline6 Subheadline2" Text="From DialogHost"/> | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles" | ||
xmlns:viewModels="clr-namespace:Material.Demo.ViewModels" | ||
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia" | ||
xmlns:models="clr-namespace:Material.Demo.Models" | ||
x:Class="Material.Demo.Pages.DialogDemo" | ||
x:DataType="viewModels:DialogDemoViewModel"> | ||
<UserControl.Resources> | ||
<StackPanel x:Key="Sample2View"> | ||
<ProgressBar Classes="Circle" IsIndeterminate="True" /> | ||
<Button Margin="0 16 0 0" | ||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"> | ||
CLOSE | ||
</Button> | ||
</StackPanel> | ||
</UserControl.Resources> | ||
<dialogHost:DialogHost Identifier="MainDialogHost"> | ||
<dialogHost:DialogHost.DialogContentTemplate> | ||
<DataTemplate DataType="models:Sample2Model"> | ||
<StackPanel> | ||
<Button Content="DialogHost is still preparing" IsEnabled="False"/> | ||
<TextBlock TextAlignment="Center">Your lucky number:</TextBlock> | ||
<TextBlock Classes="Body1" | ||
TextAlignment="Center" | ||
Text="{Binding Number}" /> | ||
<Button Margin="0 8 0 0" | ||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"> | ||
THANKS, CLOSE | ||
</Button> | ||
</StackPanel> | ||
</Grid> | ||
<StackPanel> | ||
<TextBlock Classes="Headline6 Subheadline2" Text="In messagebox"/> | ||
<StackPanel> | ||
</DataTemplate> | ||
</dialogHost:DialogHost.DialogContentTemplate> | ||
<StackPanel Margin="16, 0"> | ||
<TextBlock Classes="Headline4 Subheadline" Text="Dialogs" /> | ||
|
||
<WrapPanel> | ||
<WrapPanel.Styles> | ||
<Style Selector="WrapPanel > StackPanel, | ||
WrapPanel > Grid"> | ||
<Setter Property="Width" Value="300" /> | ||
<Setter Property="MinHeight" Value="300" /> | ||
</Style> | ||
<Style Selector="WrapPanel > StackPanel > StackPanel, | ||
WrapPanel > Grid > StackPanel"> | ||
<Setter Property="HorizontalAlignment" Value="Center" /> | ||
<Setter Property="VerticalAlignment" Value="Center" /> | ||
<Setter Property="Margin" Value="8" /> | ||
</Style> | ||
<Style | ||
Selector="WrapPanel > Grid > StackPanel > StackPanel, | ||
WrapPanel > StackPanel > StackPanel > StackPanel"> | ||
<Setter Property="Margin" Value="8" /> | ||
</Style> | ||
</WrapPanel.Styles> | ||
<Grid> | ||
<TextBlock Classes="Headline6 Subheadline2" Text="From DialogHost" /> | ||
<StackPanel> | ||
<Button Content="Show dialog #1" Command="{Binding Dialog1}"/> | ||
<TextBlock Text="{CompiledBinding Dialog1Result}" | ||
IsVisible="{CompiledBinding Dialog1Result, FallbackValue=False, | ||
Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
<TextBlock TextWrapping="Wrap">Top level dialog with custom corner radius, using OpenDialog, passing content via the Parameter. You can pass a view model, provided a corresponding DataTemplate can be found in the scope of the root DialogHost.</TextBlock> | ||
<StackPanel Margin="8 8 8 0"> | ||
<Button Margin="8" Click="OpenDialogWithView">PASS VIEW</Button> | ||
<Button Margin="8" Click="OpenDialogWithModel">PASS MODEL</Button> | ||
<Button Margin="8" Click="OpenMoreDialogHostExamples">MORE EXAMPLES</Button> | ||
</StackPanel> | ||
</StackPanel> | ||
</Grid> | ||
<StackPanel> | ||
<TextBlock Classes="Headline6 Subheadline2" Text="In messagebox" /> | ||
<StackPanel> | ||
<Button Content="Show dialog #2" Command="{Binding Dialog2}"/> | ||
<TextBlock Text="{CompiledBinding Dialog2Result}" | ||
IsVisible="{CompiledBinding Dialog2Result, FallbackValue=False, | ||
<StackPanel> | ||
<Button Content="Show dialog #1" Command="{Binding Dialog1}" /> | ||
<TextBlock Text="{CompiledBinding Dialog1Result}" | ||
IsVisible="{CompiledBinding Dialog1Result, FallbackValue=False, | ||
Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Show dialog #3" Command="{Binding Dialog3}"/> | ||
<TextBlock Text="{CompiledBinding Dialog3Result}" | ||
IsVisible="{CompiledBinding Dialog3Result, | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Show dialog #2" Command="{Binding Dialog2}" /> | ||
<TextBlock Text="{CompiledBinding Dialog2Result}" | ||
IsVisible="{CompiledBinding Dialog2Result, FallbackValue=False, | ||
Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Show dialog #3" Command="{Binding Dialog3}" /> | ||
<TextBlock Text="{CompiledBinding Dialog3Result}" | ||
IsVisible="{CompiledBinding Dialog3Result, | ||
FallbackValue=False, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Show dialog #4" Command="{Binding Dialog4}"/> | ||
<TextBlock Text="{CompiledBinding Dialog4Result}" | ||
IsVisible="{CompiledBinding Dialog4Result, | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Show dialog #4" Command="{Binding Dialog4}" /> | ||
<TextBlock Text="{CompiledBinding Dialog4Result}" | ||
IsVisible="{CompiledBinding Dialog4Result, | ||
FallbackValue=False, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Login dialog" Command="{Binding LoginDialog}"/> | ||
<TextBlock Text="{CompiledBinding LoginDialogResult}" | ||
IsVisible="{CompiledBinding LoginDialogResult, | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Login dialog" Command="{Binding LoginDialog}" /> | ||
<TextBlock Text="{CompiledBinding LoginDialogResult}" | ||
IsVisible="{CompiledBinding LoginDialogResult, | ||
FallbackValue=False, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Rename file dialog" Command="{Binding FolderNameDialog}"/> | ||
<TextBlock Text="{CompiledBinding FolderNameDialogResult}" | ||
IsVisible="{CompiledBinding FolderNameDialogResult, | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="Rename file dialog" Command="{Binding FolderNameDialog}" /> | ||
<TextBlock Text="{CompiledBinding FolderNameDialogResult}" | ||
IsVisible="{CompiledBinding FolderNameDialogResult, | ||
FallbackValue=False, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="TimePicker dialog" Command="{Binding TimePickerDialog}"/> | ||
<TextBlock Text="{CompiledBinding TimePickerDialogResult}" | ||
IsVisible="{CompiledBinding TimePickerDialogResult, | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="TimePicker dialog" Command="{Binding TimePickerDialog}" /> | ||
<TextBlock Text="{CompiledBinding TimePickerDialogResult}" | ||
IsVisible="{CompiledBinding TimePickerDialogResult, | ||
FallbackValue=False, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="DatePicker dialog" Command="{Binding DatePickerDialog}"/> | ||
<TextBlock Text="{CompiledBinding DatePickerDialogResult}" | ||
IsVisible="{CompiledBinding DatePickerDialogResult, | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<Button Content="DatePicker dialog" Command="{Binding DatePickerDialog}" /> | ||
<TextBlock Text="{CompiledBinding DatePickerDialogResult}" | ||
IsVisible="{CompiledBinding DatePickerDialogResult, | ||
FallbackValue=False, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" | ||
Margin="8" HorizontalAlignment="Center"/> | ||
Margin="8" HorizontalAlignment="Center" /> | ||
</StackPanel> | ||
</StackPanel> | ||
</StackPanel> | ||
</StackPanel> | ||
</WrapPanel> | ||
</StackPanel> | ||
</UserControl> | ||
</WrapPanel> | ||
</StackPanel> | ||
</dialogHost:DialogHost> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
|
||
namespace Material.Styles.Assists | ||
{ | ||
public class ComboBoxAssist | ||
{ | ||
public static AvaloniaProperty<string> LabelProperty = AvaloniaProperty.RegisterAttached<ComboBox, string>( | ||
"Label", typeof(ComboBox)); | ||
|
||
public static void SetLabel(AvaloniaObject element, string value) => element.SetValue(LabelProperty, value); | ||
|
||
public static string GetLabel(AvaloniaObject element) => (string)element.GetValue(LabelProperty); | ||
} | ||
} |
Oops, something went wrong.