Avalonia DataGridTextColumn styling

426 views Asked by At

I'm moving project from WPF .net 6 to Avalonia and i'm struggling with styling datagridtextcolumn. In pure WPF My code is:

<DataGridTextColumn Binding="{Binding Name}" Header="Имя" >
    <DataGridTextColumn.CellStyle>
        <Style TargetType="DataGridCell">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Label >
                            <Label.Content >
                                <MultiBinding Converter="{StaticResource TextBoxMiscConverter}">
                                    <Binding Path="Name" />
                                    <Binding Path="IsChecked" ElementName="ShowEnglishCbx" />
                                    <Binding Path="IsChecked" ElementName="ShowRussianCbx" />
                                </MultiBinding>
                            </Label.Content>
                        </Label>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </DataGridTextColumn.CellStyle>
</DataGridTextColumn>

And in pure WPF it works perfectly, but i can't find proper solution for Avalonia

I'm reading avalonia documentation and i can't find proper solution.

1

There are 1 answers

0
Sfairait On BEST ANSWER

Found a solution for my case:

<DataGridTextColumn Header="Имя" Binding="{Binding Name}" >
   <DataGridTextColumn.Binding>
      <MultiBinding Converter="{StaticResource TextBoxMiscConverter}">
         <Binding Path="Name" />
         <Binding Path="IsChecked" ElementName="EnglishTextChk" />
         <Binding Path="IsChecked" ElementName="CyrTextChk" />
      </MultiBinding>
   </DataGridTextColumn.Binding>
</DataGridTextColumn>