Posts

Showing posts with the label WPF

How to get CommunityToolkit.Mvvm to work in .NET 9

The way for  old  WPF apps was using MVVMLight   library   by Laurent Bugnion. Now I am trying to get  WPF to work in a modern .NET 9 world. I am t rying to get the  CommunityToolkit.Mvvm package (aka MVVM Toolkit, formerly named Microsoft.Toolkit.Mvvm) at  Community MVVM   to work, but I am having trouble with the data binding to commands to display a screen.  The latest incarnation does not appear to have BaseViewModels or ViewModelLocators. The documentation part to get this to work is likely the  RelayCommand  page.  My core problem is likely setting the DataContext="{Binding Source=vm:MainWindowViewModel}" of the Main Window's xaml so it links. I need to look through a Sample App  I found to ensure my bindings and visibilities are correct. UPDATE - Got commands working to the View Model. Attempting to set the DataContext to the VM on the Window failed. Main Window: <Window x:Class="CodeGen.MainWindow" x...

WPF: Multi-Binding on DataGridTextColumn

WPF: Multi-Binding on DataGridTextColumn   OLD:       <DataGridTextColumn Header="{x:Static resx:Strings.LaborNominalBaseLaborRate}" IsReadOnly="True"                                     CellStyle="{StaticResource dgReadOnlyCell}"                                     HeaderStyle="{StaticResource dgReadOnlyColHeader}"                                     Binding="{Binding NominalBurdenedLaborRate, Converter={StaticResource CurrencyFullConvert...

WPF DialogHost

WPF DialogHost   Works with DialogHost calls such as: DialogHost.Show(new CurrencyView() { DataContext = _sessionVm }, "RootDialog"); These Accept and Close: <Button Style="{StaticResource AcceptButtonStyle}" Margin="4" HorizontalAlignment="Left" Width="100">     <Button.Command>         <utilities:CompositeCommand>             <utilities:CommandBindingPassThru CommandIdentifier="closeDialog"                                               IsAlwaysEnabled="True"                               ...