Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:43
    maxkatz6 commented #6297
  • 02:26
    nlogozzo commented #6297
  • 02:25
    nlogozzo commented #6297
  • 02:17
    maxkatz6 commented #6297
  • 01:53
    nlogozzo opened #6297
  • 01:53
    nlogozzo labeled #6297
  • Jul 23 18:47
    robloo commented #6286
  • Jul 23 17:37
    wieslawsoltes labeled #6271
  • Jul 23 15:10
    Gillibald synchronize #4893
  • Jul 23 14:50
    pr8x commented #6294
  • Jul 23 13:52
    Gillibald commented #6294
  • Jul 23 13:37
    FoggyFinder commented #6292
  • Jul 23 10:32
    pr8x opened #6294
  • Jul 23 10:32
    pr8x labeled #6294
  • Jul 23 08:57
    pr8x synchronize #6191
  • Jul 23 05:42
    michalwitek1232 closed #6230
  • Jul 23 02:44
    maxkatz6 commented #6291
  • Jul 23 02:30
    Mochengvia closed #6291
  • Jul 23 02:30
    Mochengvia commented #6291
  • Jul 23 02:26
    Mochengvia commented #6291
Sam6966
@Sam6966
Nick, I will upvote, and look forward to the next installment. Cheers All
Xing Hong
@Xing1985
image.png
Nick Polyak
@npolyak
@Xing1985 I think you should NOT set the corresponding width or height and perhaps set the corresponding HorizontalAlignment or VerticalAlignment to Stretch
Xing Hong
@Xing1985
let me check
Nick Polyak
@npolyak
@Xing1985 if you publish your code I'll be able to help more
@Sam6966 Thanks Sam - I plan to write a new installment within a week or 2
Xing Hong
@Xing1985
image.png
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="using:basehead.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="basehead.Views.MainWindow" Icon="/Assets/avalonia-logo.ico" Width="650" Height="450" Title="basehead">

<Design.DataContext>
<vm:MainWindowViewModel/>
</Design.DataContext>
<TabControl>
<TabControl.Styles>
<Style Selector="TextBlock.PanelHeader">
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="5,5,5,10"/>
</Style>
</TabControl.Styles>
<TabItem Header="DockPanel">
<DockPanel Margin="20">
<Button Content="1" DockPanel.Dock="Left" Width="30"/>
<Button DockPanel.Dock="Top" Content="2" Height="30"/>
<Button DockPanel.Dock="Right" Content="3" Width="30"/>
<Button DockPanel.Dock="Bottom" Content="4" Height="30"/>
<Button DockPanel.Dock="Left" Content="5" Width="30"/>
<Button DockPanel.Dock="Top" Content="6" Height="30"/>
<Button DockPanel.Dock="Right" Content="7" Width="30"/>
<Button DockPanel.Dock="Bottom" Content="8" Height="30"/>
<Button Content="The Rest"/>
</DockPanel>
</TabItem>
</TabControl>
</Window>
Nick Polyak
@npolyak
@Xing1985 try setting the first button's VerticalAlignment to Stretch. In the meanwhile let me try to reproduce the problem on my machine
Xing Hong
@Xing1985
yeah, good working now
thx!
Nick Polyak
@npolyak
cool, pleasure - if you like my article, please, upvote :)
thanks
Xing Hong
@Xing1985
and I have an issue when using TabControl on mac os. If I set the SelectedIndex of TabControl in TabControl_SelectionChanged event then it goes to the selected tab and then if I click another TabItem then always go to the previouse TabItem. The Windows version is good working.
image.png
this is my code part
Nick Polyak
@npolyak
It is almost midnight here - so I'll have to quit soon, but you should not reset SelectedIndex in the SelectionChanged handler - it can lead to a circular code
Xing Hong
@Xing1985
how do i force select another tab?
Sam6966
@Sam6966
Hi Nick, I'm guessing when you upvote, you rate with the stars?
Nick Polyak
@npolyak
Best of all would be to bind the SelectedIndex property to something on a view model
you can create TheSelectedIndex StyleProperty and
try to change it to whatever you want in your control
@Sam6966 yes, you select the number of the stars
Xing Hong
@Xing1985
ok, thank you for your help
Nick Polyak
@npolyak
I think you might need to register for the codeproject site
pleasure @Xing1985
Xing Hong
@Xing1985
I just did upvote your article. :wink:
Nick Polyak
@npolyak
Then you bind your TabControl.SelectedIndex property to the TheSelectedIndex on your control - it has to be a two way binding
thanks
Sam6966
@Sam6966
Yes already registered and rated 5 stars. First time rating an article. Enjoy your evening.
Nick Polyak
@npolyak
if you want send me the full code for your control or tell me where to download it from and I'll take a look at it tomorrow
Thanks @Xing1985 and @Sam6966
good night!
Xing Hong
@Xing1985
Have a good Dream!
bitbonk
@bitbonk
image.png
The XamlControlsGallery on master (.NET Core) has may empty entries, is this expected? (see above screenshot)
Timothy
@timothyparez

Hi All, I just published an AvaloniaUI tutorial on the codeproject - https://www.codeproject.com/Articles/5308645/Multiplatform-UI-Coding-with-AvaloniaUI-in-Easy-Sa. I'd appreciate some feedback. Thanks

will check it out!

Dan Walmsley
@danwalmsley
@bitbonk yes... we need people to help finish it :)
1 reply
Timothy
@timothyparez
I have a UserControl with a StyledProperty<ObservableCollection<SomeType>>
I call AffectsRender<MyUserControl>(SpatialsProperty); which causes the control to render if I change the property but what I actually want its to
render whenever items are added or removed. Do I just use ObservableCollection.CollectionChanged or is there a better way?
Andreas Schauerte
@schauerte
Is there any example for using TreeView (and providing children selector in XAML)?
Andreas Schauerte
@schauerte

Is there any example for using TreeView (and providing children selector in XAML)?

Stupid question - right here: https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/TreeViewPage.xaml

Timothy
@timothyparez
If it had been a stupid question there wouldn't be a sample to answer your question :)
boonkerz
@boonkerz
how can i add an close icon to the tabheader?
<TabControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Header}" /> <Button Command="{Binding CloseTab}"> <avalonia:MaterialIcon Kind="Close"></avalonia:MaterialIcon> </Button> </StackPanel> </DataTemplate> </TabControl.ItemTemplate>
the command is not executed?
Daniel Lukach
@dlukach_gitlab
hey all, trying to make a datagrid to display some data. Having some issues displaying the datagrid, I bound the columns to seperate observable collections. Any pointers?
<DataGrid IsVisible="{Binding IsTableChecked}" Items="{Binding}" HeadersVisibility="All" AutoGenerateColumns="True">
            <DataGrid.Columns>

                <DataGridTextColumn Header="{Binding LoadColumnString}" Binding="{Binding BufferLoad }" IsVisible="True" Width="*"/>
                <DataGridTextColumn Header="{Binding DistanceColumnString}" Binding="{Binding BufferDistance}" IsVisible="True" Width="*"/>
                <DataGridTextColumn Header="{Binding TimeColumnString}" Binding="{Binding BufferTime}" IsVisible="True" Width="*"/>
            </DataGrid.Columns>
        </DataGrid>
Tobias Johansson
@kvalitetskontrollMarkaryd
@dlukach_gitlab You should not define columns if AutoGenerateColumns="True" and Items should bind to a ObservableCollection on the ViewModel. If you define Columns each column should be bound to the correct Property of that Class that defines the Collection.
ShrutiJaiswal1494
@ShrutiJaiswal1494

Hey All, I have High Contrast (Settings->Ease of Access->High Contrast) mode enabled with a High Contrast Black Theme selected on my computer. When I run my Avalonia Application it still shows me the same colors (attached a picture below). Seems like it is not changing based on the high contrast theme that I have selected. However the WPF applications are changing colors by default based on the theme selected. Is there something I need to add to my application to make sure Avalonia responds to the high contrast mode? Any help is much appreciated. Thanks.

image

Daniusvl
@Daniusvl
image.png
2 replies
Hello pls help