reactiveui

Using ReactiveUI wpf unable to bind List of Enum values from viewmodel to combobox in view

跟風遠走 提交于 2019-12-24 19:08:31
问题 Lets say I have this enum public enum LogType { None = 0, File = 1, Folder = 2 } I have this ComboBox in view <ComboBox Name="CustomLogLogType" FontSize="10" MinHeight="20" Height="20" SelectedItem="{Binding LogType}"> Then a ViewModel like so public class CustomLogRuleItemViewModel : ReactiveObject { [Reactive] public LogType LogType { get; set; } = LogType.File; public List<LogType> LogTypes => Enum.GetValues(typeof(LogType)).Cast<LogType>().Where(_ => _ != LogType.None).ToList(); } Then in

ReactiveUI routing and Windows Phone

别说谁变了你拦得住时间么 提交于 2019-12-24 18:30:02
问题 I'm continuing ReactiveUI explorations on Windows Phone, and have came to a moment where I need to do a navigation between pages. Obviously, I want to do this with the ReactiveUI. Unfortunately, googling (and binging) around didn't give any samples on that. The most useful thing I was able to find is "Play for Windows" on GitHub, which have the routing implemented. But I don't think that technique could apply to the Windows Phone programming, since navigation between WP pages is very

Combine dependency properties

 ̄綄美尐妖づ 提交于 2019-12-24 11:14:33
问题 I've done a few WPF projects now and see the same problem pop up and that is the "problem" of aggregating/combining dependency properties (dp's). For example, I have 10 dp's of type bool that I want to combine and expose as a seperated dp. The combined dp is true unless one or more its constituents is false. I currently do this using the addValueChanged which registers a callback for each of the 10 (!() dp's but am wondering if there are more elegant solutions or maybe a framework that

Combine dependency properties

拟墨画扇 提交于 2019-12-24 11:13:50
问题 I've done a few WPF projects now and see the same problem pop up and that is the "problem" of aggregating/combining dependency properties (dp's). For example, I have 10 dp's of type bool that I want to combine and expose as a seperated dp. The combined dp is true unless one or more its constituents is false. I currently do this using the addValueChanged which registers a callback for each of the 10 (!() dp's but am wondering if there are more elegant solutions or maybe a framework that

Executing a command from another command

人盡茶涼 提交于 2019-12-24 10:52:05
问题 I have a 'hello world' form (Xamarin forms) with some fields and a submit button. There's an observable (CanSave) which controls when the SaveChangesCommand can execute. If the save button is pressed when the CanSave is false, I want to a display a message to the user. With the code below, if I enter incorrect data click save (the error message shows) then correct the data. CanSave becomes true and SaveChangesCommand is executed - before the button is hit again. It's as though the previously

ReactiveUI: Can't get code to run on background thread

若如初见. 提交于 2019-12-24 04:33:14
问题 Just dabbling with RxUI and trying to get a noddy example to work... I've got a WPF view with a ListBox and a button. When I press the button (Go) I want to run a method on a background thread and have the results it produces be added to the ListBox. I'm logging the thread id to check what's executing where. The problem is I always see all the operations happening on the same thread. I've tried specifying Scheduler.Default on the CreateAsyncObservable but then nothing gets added to the

ReactiveUI: Can't get code to run on background thread

烈酒焚心 提交于 2019-12-24 04:33:03
问题 Just dabbling with RxUI and trying to get a noddy example to work... I've got a WPF view with a ListBox and a button. When I press the button (Go) I want to run a method on a background thread and have the results it produces be added to the ListBox. I'm logging the thread id to check what's executing where. The problem is I always see all the operations happening on the same thread. I've tried specifying Scheduler.Default on the CreateAsyncObservable but then nothing gets added to the

ReactiveCommand not respecting canExecute

穿精又带淫゛_ 提交于 2019-12-24 03:13:48
问题 Perhaps I'm missing something, however I can't get ReactiveCommand to prevent execution based on the canExecute observable. Below is the simplest example I can conjure. I would expect the command to never fire, however it is. What am I missing? void Main() { var canExecute = Observable.Return(false); var myCommand = ReactiveCommand.CreateAsyncTask(canExecute, m => functions.doAllThings(m)); myCommand.Subscribe(x=>"executing".Dump()); myCommand.Execute("Tom"); // This fires the command. I

Execute a set of commands in order, sequentially with ReactiveUI

谁说胖子不能爱 提交于 2019-12-24 01:45:19
问题 I have a ViewModel with some ReactiveCommands that user can invoke manually. CommandA CommandB CommandC So the user can invoke only B , or A first, and then C . The problem is that there is that I want to create another command that runs them in order , from A to C. They shouldn't run in parallel, but sequentially . How can I do a command of the given characteristics? 回答1: Import System.Reactive.Linq, now you can: { await CommandA.Execute(); await CommandB.Execute(); await CommandC.Execute();

Get rid of Xamarin's “…you may need to supply runtime policy” warning

佐手、 提交于 2019-12-23 17:15:03
问题 In my Xamarin Mac project, I am seeing the following warning multiple times. I tried clearing the nuget cache, but it did not help me. Why is it shown and what is required to get it fixed? 来源: https://stackoverflow.com/questions/53452050/get-rid-of-xamarins-you-may-need-to-supply-runtime-policy-warning