mvvm

MVVM - Accessing ViewModel/SQLite in a BroadcastReceiver started from a notification when app is closed

。_饼干妹妹 提交于 2021-02-07 14:15:36
问题 I have a reminder notification that is sent every few days. The sending of that notification is triggered with a repeating AlarmManager . The notification itself is built in the onReceive of my BroadcastReceiver (as described here). So when onReceive is triggered, the app is not even open/running. Now at that point I want to access my (local) SQLite database and get the correct content to build the notification with, but how would I get a ViewModelProvider (xxx in the code) in this place to

How should `ICommand.CanExecuteChanged` be implemented? [closed]

谁说我不能喝 提交于 2021-02-07 14:13:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . Improve this question Background While looking at Josh Smith's article about CommandGroup , I noticed that there are a number of comments on the Internet about how to implement ICommand.CanExecuteChanged . A similar question was posted here on StackOverflow, but I don't feel like

MVVM - Accessing ViewModel/SQLite in a BroadcastReceiver started from a notification when app is closed

╄→尐↘猪︶ㄣ 提交于 2021-02-07 14:13:15
问题 I have a reminder notification that is sent every few days. The sending of that notification is triggered with a repeating AlarmManager . The notification itself is built in the onReceive of my BroadcastReceiver (as described here). So when onReceive is triggered, the app is not even open/running. Now at that point I want to access my (local) SQLite database and get the correct content to build the notification with, but how would I get a ViewModelProvider (xxx in the code) in this place to

MVVM - Accessing ViewModel/SQLite in a BroadcastReceiver started from a notification when app is closed

↘锁芯ラ 提交于 2021-02-07 14:12:40
问题 I have a reminder notification that is sent every few days. The sending of that notification is triggered with a repeating AlarmManager . The notification itself is built in the onReceive of my BroadcastReceiver (as described here). So when onReceive is triggered, the app is not even open/running. Now at that point I want to access my (local) SQLite database and get the correct content to build the notification with, but how would I get a ViewModelProvider (xxx in the code) in this place to

How should `ICommand.CanExecuteChanged` be implemented? [closed]

若如初见. 提交于 2021-02-07 14:04:17
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . Improve this question Background While looking at Josh Smith's article about CommandGroup , I noticed that there are a number of comments on the Internet about how to implement ICommand.CanExecuteChanged . A similar question was posted here on StackOverflow, but I don't feel like

How do View Models propagate change notification from their underlying Models if the Model do not implement INotifyPropertyChanged?

大兔子大兔子 提交于 2021-02-07 12:52:47
问题 Reading Josh Smiths article about MVVM his view model CustomerViewModel implements INotifyPropertyChanged but not the underlying Customer class. I can only see one (feasible) way to make change notification work in that case - only make changes to the CustomerViewModel and not the Customer . In that case, should the backend logic of my program also simply work against ViewModels? That seems pretty weird, they being View Models after all. Anyone that can clarify this a bit? Thanks!

Using IMultiValueConverter to pass multiple CommandParameters to viewModel

萝らか妹 提交于 2021-02-07 12:35:30
问题 I have the following code: <DataGridTemplateColumn Header="Security"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Name="Security" Content="{Binding Path=totalSecurities}" Command="{Binding Source={StaticResource viewModel}, Path=filterGridCommand}"> <Button.CommandParameter> <MultiBinding Converter="{StaticResource PassThroughConverter}"> <Binding Path="sector"/> <Binding ElementName="Security" Path="Name"/> </MultiBinding> </Button.CommandParameter> </Button> </DataTemplate>

Prevent WPF Frame from storing history in the stack

只愿长相守 提交于 2021-02-07 12:31:07
问题 This seems like it would be an easy solution, but I'm wasting too much time trying to figure this out. Perhaps I am designing my application incorrectly (which might be the case), so please help me out if you have a better solution. I'm designing an enterprise level WPF application that looks a lot like Outlook with a Ribbon instead of a toolbar. I have a lot of different modules that are loaded into a frame when the user clicks on a RibbonButton . Keep in mind that his ribbon is shared

Collapse all the expanders and expand one of them by default

扶醉桌前 提交于 2021-02-07 07:15:27
问题 I have multiple expanders, and I was looking for a way to collapse all others the expanders when one of them is expanded. And I found this solution here XAML: <StackPanel Name="StackPanel1"> <StackPanel.Resources> <local:ExpanderToBooleanConverter x:Key="ExpanderToBooleanConverter" /> </StackPanel.Resources> <Expander Header="Expander 1" IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=1}"> <TextBlock>Expander 1<

Collapse all the expanders and expand one of them by default

杀马特。学长 韩版系。学妹 提交于 2021-02-07 07:14:45
问题 I have multiple expanders, and I was looking for a way to collapse all others the expanders when one of them is expanded. And I found this solution here XAML: <StackPanel Name="StackPanel1"> <StackPanel.Resources> <local:ExpanderToBooleanConverter x:Key="ExpanderToBooleanConverter" /> </StackPanel.Resources> <Expander Header="Expander 1" IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=1}"> <TextBlock>Expander 1<