diff options
Diffstat (limited to 'Samples/common')
12 files changed, 278 insertions, 13 deletions
diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index 93526308..0aac7873 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -86,6 +86,10 @@ namespace Samples if (!string.IsNullOrEmpty(selItem)) ObservableTestList.Remove(lb.SelectedItem as string); },null, true); + CMDObsListRemove2 = new ActionCommand ("Remove2", + () => { + ObservableTestList.Remove(observableTestListSelectedItem); + },null, false); } DeviceEventType deviceEventTypeEnum; public DeviceEventType DeviceEventTypeEnum { @@ -332,7 +336,7 @@ namespace Samples } } - public ActionCommand CMDObsListAdd,CMDObsListRemove; + public ActionCommand CMDObsListAdd,CMDObsListRemove,CMDObsListRemove2; string obsListNewItem = "new item"; public string ObsListNewItem { get => obsListNewItem; @@ -345,8 +349,17 @@ namespace Samples } } public ObservableList<string> ObservableTestList = new ObservableList<string>(new string[]{"string1", "string2"}); - - + string observableTestListSelectedItem = null; + public string ObservableTestListSelectedItem { + get => observableTestListSelectedItem; + set { + if (value == observableTestListSelectedItem) + return; + observableTestListSelectedItem = value; + NotifyValueChanged(ObservableTestListSelectedItem); + CMDObsListRemove2.CanExecute = !string.IsNullOrEmpty(observableTestListSelectedItem); + } + } IList<Colors> testList = (IList<Colors>)EnumsNET.Enums.GetValues<Colors>().ToList();//.ColorDic.Values//.OrderBy(c=>c.Hue) //.ThenBy(c=>c.Value).ThenBy(c=>c.Saturation) //.ToList (); @@ -475,6 +488,16 @@ namespace Samples } } + public Fill TestColor { + get => Configuration.Global.Get<Color> (nameof(AllWidgetBackground)); + set { + if (value == AllWidgetBackground) + return; + Configuration.Global.Set (nameof(AllWidgetBackground), value); + NotifyValueChanged (value); + } + } + diff --git a/Samples/common/ui/Interfaces/Divers/colorPicker.crow b/Samples/common/ui/Interfaces/Divers/colorPicker.crow index dc4a6abe..c1912be6 100644 --- a/Samples/common/ui/Interfaces/Divers/colorPicker.crow +++ b/Samples/common/ui/Interfaces/Divers/colorPicker.crow @@ -1,6 +1,6 @@ <?xml version="1.0"?> <VerticalStack> - <ColorPicker CurrentColor="{²../go.Background}" Name="colorPicker" Background="DimGrey" Width="250" /> + <ColorPicker CurrentColor="{²../go.Background}" Name="colorPicker" Background="DimGrey" Width="400" /> <Widget Name="go" Width="100" Height="60" Background="DarkBlue"/> <Widget Width="100" Height="60" Background="{../colorPicker.CurrentColor}"/> <Label Text="{../colorPicker.CurrentColor}"/> diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider.crow b/Samples/common/ui/Interfaces/Divers/colorSlider.crow new file mode 100644 index 00000000..012fd2dd --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/colorSlider.crow @@ -0,0 +1,75 @@ +<VerticalStack Margin="50" Spacing="20" Background="DimGrey"> + <HorizontalStack Height="Fit" Width="400" Spacing="5" Margin="5" Background="Jet"> + <Label Style="labColor" Text="G:"/> + <ColorSlider Name="cs" Component="Red" CurrentColor="Green" CursorType="Circle" ClipToClientRect="false" Background="Black" Margin="5" Height="20" /> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + <Container Width="100" Height="100" Background="Red" Margin="5"> + <Widget Width="20" Height="20" Background="Blue" HorizontalAlignment="Left" VerticalAlignment="Top"/> + </Container> + </HorizontalStack> + <Label Text="{../slider1.Value}"/> + <Widget Width="380" Height="5" Background="Blue"/> + <Slider Name="slider1" Orientation="Horizontal" Width="400" Height="30" Background="Jet" Foreground="LightGrey" Margin="0" Inverted="false"> + <Template> + <Container Background="{./Background}" CornerRadius="{./CornerRadius}" Margin="10"> + <Widget Name="Cursor" Background="{./Foreground}" CornerRadius="{./CornerRadius}" /> + </Container> + </Template> + </Slider> + <Slider Background="RoyalBlue" Height="50" Width="400" CursorSize="50" Inverted="{../../inverted.IsChecked}"> + <Template> + <Group Background="DarkGrey" > + <ColorGauge Height="50%" Background="Onyx" Value="{./Value}" Maximum="{./Maximum}" Minimum="{Minimum}" Orientation="{./Orientation}" + Inverted="{./Inverted}"/> + <Container Name="Cursor" Background="White" > + <Label Text="{./Value}" Foreground="Black"/> + </Container> + </Group> + </Template> + </Slider> + <ColorPicker> + <Template> + <Border Background="{./Background}" Foreground="{./Foreground}" Width="Stretched" + CornerRadius="{./CornerRadius}" BorderWidth="1"> + <VerticalStack Margin="2"> + <Widget Width="30" Height="16" Background="{./CurrentColor}"/> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="R:"/> + <ColorSlider Name="cs" Component="Red" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="G:"/> + <ColorSlider Name="cs" Component="Green" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="B:"/> + <ColorSlider Name="cs" Component="Blue" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="A:"/> + <ColorSlider Name="cs" Component="Alpha" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="H:"/> + <ColorSlider Name="cs" Component="Hue" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="S:"/> + <ColorSlider Name="cs" Component="Saturation" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="V:"/> + <ColorSlider Name="cs" Component="Value" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + </VerticalStack> + </Border> + </Template> + </ColorPicker> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider2.crow b/Samples/common/ui/Interfaces/Divers/colorSlider2.crow new file mode 100644 index 00000000..111ce06f --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/colorSlider2.crow @@ -0,0 +1,78 @@ +<VerticalStack Margin="50" Spacing="20" Background="DimGrey"> + <Label Text="{../slider1.Value}"/> + <Slider Background="Onyx" Height="30" Width="400" > + <Template> + <Group Background="{./Background}"> + <ColorGauge Component="Red" Height="Stretched" Value="{./Value}" Maximum="{./Maximum}" Minimum="{Minimum}" Orientation="{./Orientation}" Margin="11" + Inverted="{./Inverted}"/> + <Border Name="Cursor" Foreground="White" CornerRadius="7" BorderWidth="2"> + <Label Text="{./Value}" Foreground="WhiteSmoke"/> + </Border> + </Group> + </Template> + </Slider> + <Slider Background="Onyx" Height="30" Width="400" CursorSize="20" > + <Template> + <Group Background="{./Background}" ClipToClientRect="false"> + <ColorGauge Component="Red" Height="Stretched" Value="{./Value}" Maximum="{./Maximum}" Minimum="{Minimum}" Orientation="{./Orientation}" Margin="10" ClipToClientRect="false" + Inverted="{./Inverted}"/> + <Shape Height="Stretched" Name="Cursor" Size="30,30" Path="M 0,30 L 15,0 L 30,30 Z G" StrokeWidth="1" ClipToClientRect="false" Scaled="false" /> + </Group> + </Template> + </Slider> + <ColorPicker> + <Template> + <Border Background="{./Background}" Foreground="{./Foreground}" Width="Stretched" + CornerRadius="{./CornerRadius}" BorderWidth="1"> + <VerticalStack Margin="2"> + <Widget Width="50" Height="30" CornerRadius="10" Background="{./CurrentColor}"/> + <Slider Background="Onyx" Height="Fit" Width="Stretched" Foreground="{²./CurrentColor}" Maximum="255" Value="{².cg.Value}"> + <Template> + <Group Background="{./Background}"> + <ColorGauge Name="cg" Component="Red" Height="Stretched" Value="{²./Value}" Maximum="{./Maximum}" Minimum="{Minimum}" Orientation="{./Orientation}" Margin="0" CurrentColor="{²./Foreground}"/> + <Border Name="Cursor" Foreground="White" CornerRadius="7" BorderWidth="2"> + <Label Text="{./Value}" Foreground="WhiteSmoke"/> + </Border> + </Group> + </Template> + </Slider> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="R:"/> + <ColorSlider Name="cs" Component="Red" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="G:"/> + <ColorSlider Name="cs" Component="Green" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="B:"/> + <ColorSlider Name="cs" Component="Blue" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="A:"/> + <ColorSlider Name="cs" Component="Alpha" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="H:"/> + <ColorSlider Name="cs" Component="Hue" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="S:"/> + <ColorSlider Name="cs" Component="Saturation" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="V:"/> + <ColorSlider Name="cs" Component="Value" CurrentColor="{²./CurrentColor}"/> + <Label Style="labColorV" Text="{../cs.CurrentValue}" /> + </HorizontalStack> + </VerticalStack> + </Border> + </Template> + </ColorPicker> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider3.crow b/Samples/common/ui/Interfaces/Divers/colorSlider3.crow new file mode 100644 index 00000000..4236b929 --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/colorSlider3.crow @@ -0,0 +1,47 @@ +<VerticalStack Margin="50" Spacing="20" Background="Black"> + <ColorPicker> + <Template> +<Border Background="{./Background}" Foreground="{./Foreground}" Width="Stretched" + CornerRadius="{./CornerRadius}" BorderWidth="1"> + <VerticalStack Margin="2"> + <Widget Width="30" Height="16" Background="{./CurrentColor}"/> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="R:"/> + <ColorSlider Name="cs" Component="Red" CurrentColor="{./CurrentColor}" Value="{²./Red}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="G:"/> + <ColorSlider Name="cs" Component="Green" CurrentColor="{./CurrentColor}" Value="{²./Green}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="B:"/> + <ColorSlider Name="cs" Component="Blue" CurrentColor="{./CurrentColor}" Value="{²./Blue}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="A:"/> + <ColorSlider Name="cs" Component="Alpha" CurrentColor="{./CurrentColor}" Value="{²./Alpha}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="H:"/> + <ColorSlider Name="cs" Component="Hue" CurrentColor="{./CurrentColor}" Value="{²./Hue}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="S:"/> + <ColorSlider Name="cs" Component="Saturation" CurrentColor="{./CurrentColor}" Value="{²./Saturation}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Style="labColor" Text="V:"/> + <ColorSlider Name="cs" Component="Value" CurrentColor="{./CurrentColor}" Value="{²./Value}"/> + <Label Style="labColorV" Text="{../cs.Value}" /> + </HorizontalStack> + </VerticalStack> +</Border> + </Template> + </ColorPicker> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/colorSlider4.crow b/Samples/common/ui/Interfaces/Divers/colorSlider4.crow new file mode 100644 index 00000000..95463636 --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/colorSlider4.crow @@ -0,0 +1,13 @@ +<ColorSlider Width="400" Component="Red" Background="Grey" Height="34" CursorSize="24" > +<Template> + <Group Background="{./Background}" > + <ColorGauge Component="{./Component}" CurrentColor="{./CurrentColor}" Orientation="{./Orientation}" Margin="10" Height="Stretched" CornerRadius="10"/> + <Border Name="Cursor" Foreground="White" CornerRadius="15" BorderWidth="2"> + <Group Fit="true"> + <Label Left="2" Top="2" Text="{./Value}" Foreground="Black" Font="mono bold, 10"/> + <Label Text="{./Value}" Foreground="WhiteSmoke" Font="mono bold, 10"/> + </Group> + </Border> + </Group> +</Template> +</ColorSlider>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/image.crow b/Samples/common/ui/Interfaces/Divers/image.crow new file mode 100644 index 00000000..829507ac --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/image.crow @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<Image Path="#Crow.Icons.file.svg" Width="16" Height="16"/> diff --git a/Samples/common/ui/Interfaces/Divers/observableList.crow b/Samples/common/ui/Interfaces/Divers/observableList.crow index 9caa0b43..6d568820 100644 --- a/Samples/common/ui/Interfaces/Divers/observableList.crow +++ b/Samples/common/ui/Interfaces/Divers/observableList.crow @@ -4,8 +4,9 @@ <HorizontalStack Height="Fit"> <Button Command="{CMDObsListAdd}" /> <Button Command="{CMDObsListRemove}" IsEnabled="{../lb.SelectionIsEmpty}" /> + <Button Command="{CMDObsListRemove2}"/> </HorizontalStack> - <ListBox Name="lb" Data="{ObservableTestList}" > + <ListBox Name="lb" Data="{ObservableTestList}" SelectedItem="{²ObservableTestListSelectedItem}" > <Template> <Border Style="ControlBorder" MinimumSize="10,10" Background="{./Background}" CornerRadius="{./CornerRadius}"> <Scroller Name="scroller1" > diff --git a/Samples/common/ui/Interfaces/Divers/testShape.crow b/Samples/common/ui/Interfaces/Divers/testShape.crow index 14af0f21..14df5bfc 100644 --- a/Samples/common/ui/Interfaces/Divers/testShape.crow +++ b/Samples/common/ui/Interfaces/Divers/testShape.crow @@ -1,5 +1,10 @@ <?xml version="1.0"?> <VerticalStack> - <TextBox Text="{²../shape.Path}"/> - <Shape Margin="0" Width="400" Height="400" Name="shape" Foreground="Blue" Background="DimGrey" Size="100,100" Path="M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z G"/> + <TextBox Text="{²../shape.Path}"/> + <Container Background="Navy" Height="100" Width="100"> + <Shape Height="20" Width="10" Name="shape" Foreground="White" Size="11,11" Path="M 5.5,1.5 L 9.5,3.5 L 9.5,9.5 L 1.5,9.5 L 1.5,3.5 Z G" Scaled="true" KeepProportions="false" StrokeWidth="2"/> + </Container> + <Container Background="Navy" Height="100" Width="100"> + <Shape Height="Fit" Width="Fit" Foreground="White" Size="11,11" Path="{²../../shape.Path}" Scaled="false" KeepProportions="false" StrokeWidth="2"/> + </Container> </VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/testSlider.crow b/Samples/common/ui/Interfaces/Divers/testSlider.crow index d7050000..8b6e57af 100644 --- a/Samples/common/ui/Interfaces/Divers/testSlider.crow +++ b/Samples/common/ui/Interfaces/Divers/testSlider.crow @@ -1,6 +1,5 @@ <?xml version="1.0"?> <HorizontalStack Margin="50"> - <CheckBox Name="inverted" Background="DarkSlateGrey" Caption="Inverted" Width="Fit" Foreground="Black"/> <VerticalStack Spacing="10" Width="50%"> <Slider Background="DarkGrey" Height="20" Width="Stretched" Inverted="{../../inverted.IsChecked}"/> @@ -31,6 +30,8 @@ <Slider ClipToClientRect='false' Background="DarkGrey" CursorSize="50" Height="12" CornerRadius="5" Inverted="{../../inverted.IsChecked}" /> <Slider ClipToClientRect='false' CacheEnabled='false' Background="Transparent" CursorSize="20" Height="12" Width="Stretched" Inverted="{../../inverted.IsChecked}" /> + + <CheckBox Name="inverted" Background="DarkSlateGrey" Caption="Inverted" Width="Fit" Foreground="Black"/> </VerticalStack> <HorizontalStack Spacing="10" > diff --git a/Samples/common/ui/Interfaces/Experimental/table.crow b/Samples/common/ui/Interfaces/Experimental/table.crow index 53222664..c1e8f483 100644 --- a/Samples/common/ui/Interfaces/Experimental/table.crow +++ b/Samples/common/ui/Interfaces/Experimental/table.crow @@ -1,11 +1,11 @@ <Table Columns="test,Fit;test,Fit;test,Stretched;test,Fit" Margin="10" - ColumnSpacing="5" Spacing="5" + ColumnSpacing="15" Spacing="5" Height="Fit" Foreground="Grey" - RowsMargin="0" - BorderLineWidth="0" - VerticalLineWidth="1" + RowsMargin="5" + BorderLineWidth="1" + VerticalLineWidth="2" HorizontalLineWidth="1" - Background="DarkGrey" > + Background="Jet" > <TableRow Height="Fit" > <Label Text="firstlkjdqsfmlkjqsl" Background="1,0,0,0.5" HorizontalAlignment="Left" Height="Stretched"/> <Label Text="second" Background="0,1,0,0.5" Height="Stretched"/> diff --git a/Samples/common/ui/Interfaces/TemplatedControl/testScrollbar2.crow b/Samples/common/ui/Interfaces/TemplatedControl/testScrollbar2.crow new file mode 100644 index 00000000..6a7a7c91 --- /dev/null +++ b/Samples/common/ui/Interfaces/TemplatedControl/testScrollbar2.crow @@ -0,0 +1,20 @@ +<HorizontalStack> + <Container Width="50%"> + <Label Text="{../../sb.Value}" /> + </Container> + <ScrollBar Name="sb" Maximum="200" CursorRatio="0.3" Width="16" LargeIncrement="20" SmallIncrement="1"> + <Template> + <Border BorderWidth="1" Foreground="{./Foreground}" Background="{./Background}"> + <GenericStack Orientation="{./Orientation}" Spacing="0"> + <Shape Style="ArrowBut" MouseDown="./OnDecrease" Height="{./Width}" Margin="0" + Size="10,10" Path="M 4.5,0.5 L 9.5,9.5 L 0.5,9.5 Z F"/> + <Container Margin="1"> + <Widget Style="ScrollBarCursor" Name="Cursor" CornerRadius="{./CornerRadius}"/> + </Container> + <Shape Style="ArrowBut" MouseDown="./OnIncrease" Height="{./Width}" Margin="0" + Size="10,10" Path="M 0.5,0.5 L 9.5,0.5 L 4.5,9.5 Z F"/> + </GenericStack> + </Border> + </Template> + </ScrollBar> +</HorizontalStack>
\ No newline at end of file |