Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all 1760 articles
Browse latest View live

New Post: Thank you.... and one final question

$
0
0
Firstly thanks to those who have helped me out over the last month or so transform my app from code behind to a well structure caliburn/mvvm pattern. Its now so easy to manage!

I have a final question regarding views. On my home page I have 5 list boxes which show the "Top 5" scores from 5 golf tours. Is it possible to use a list of(listboxes) or user controls with the caliburn conventions? then rather than declaring 5 individual properties for each list I can just use a list/array.
<ListBox x:Name="Scores" ...
<ListBox x:Name="ABCScores"
<ListBox x:Name="123Scores" ...

Ideally I'm looking for someway to implement
<ListBox x:Name="Scores[0]"...

if this is not possible its not a problem

again thanks d.

New Post: Thank you.... and one final question

$
0
0
You can create a list of scores groups, with specific view-models and views.

What I mean is, every set of scores has to be wrapped in a ScoresGroupViewModel, something like
publicclass ScoresGroupViewModel : PropertyChangedBase, IHaveDisplayName
{
         publicstring DisplayName { get { ... } set { ... } }  //Store here the 'name' of the group, just like "ABCScores"...public ObservableCollection<ScoreViewModel> Scores { get; privateset; }

         //Code omitted...
}
Every group would use the same view
<UserControl...><ListBoxx:Name="Scores".../><!-- Other than the individual scores, a proper header should be provided, displaying the DisplayName for group of scores --></UserControl>
The view-model exposing all grouped scores, will use a simple ItemsControl to display all listboxes
<UserControl...><ItemsControlx:Name="ScoreGroups"/><!-- Use the appropriate Panel here... probably a vertical oriented StackPanel would suffice --></UserControl>
With this approach, scores groups are defined through view-model, and the view is dinamically built. In case a specific group needs a different view, you can inherit from the base view-model class, put there some more logic and create a specifica view (something like 'Other scores, where just brief informations are displayed).

I hope this makes sense to you. Feel free to ask. :)

New Post: Message.Attach on a custom event

$
0
0
Since CM relies on the System.Windows.Interactivity.EventTrigger, it shares some limitations with it. In particular, the event needs to be either a EventHandler<T> or EventHandler, if I remember correctly.

Are you positive that this requirement is fullified?

New Post: Thank you.... and one final question

$
0
0
ah that's how its done! great thanks I was pretty close in my attempts I'll give it a whirl tonight and let you know how I get on

New Post: Win RT Settings Flyout - Windows 8.1

$
0
0
I've scoured the internet and found very little guidance on the settings flyout for 8.1. It does appear different than the Win 8 implementation and what little I could find on Win 8 doesn't seem to apply. I'd appreciate any help with the general calling of the flyout, what ViewSettings I can apply, such as width, etc. (or guidance on how I could find this out) and how to override the back arrow functionality so that it doesn't take me back to the Win 8.1 Settings Panel, but rather closes the currently opened panel.
What I have so far doesn't work with View Settings and I have a feeling I'm doing this all wrong.

var viewSettings = new Dictionary<string, object>();
viewSettings.Add("Width", 500);
windowsManager.ShowSettingsFlyout(new PassageListEditViewModel(navService, eventAggregator),"Hello", viewSettings);

Thanks for any help

New Post: Win RT Settings Flyout - Windows 8.1

$
0
0
I've figured how to override the back arrow on the settings flyout. I made my own version of SettingsWindowManager and instead of calling settingsFlyout.Show, I call settingsFlyout.ShowIndependent();
Also the view settings are working now. I still think I'm instantiating this thing wrong though.

New Post: Thank you.... and one final question

$
0
0
It works! :-) It makes things so much easier just to enumerate the list rather than hard coding each control

thanks very much and have a great weekend!

New Post: Please Add CanDeactivate function to Screen

$
0
0
Did anyone experience problems while using a tabcontrol and this tactic? I can't get it to work correctly. The child screen stays the same (correct), but the tab control itself shows a different tab selected, and I can't seem to make that selection (the visible part of it) to bind to something so I can manually set that. Any thoughts?

New Post: WPF button Command vs Content

$
0
0
<Button x:Name="CancelCommand" Content="Cancel" /> <<Convention will work

<Button Content="Cancel" Command="{Binding CancelCommand}" /> << but you lose some automagic abilities

Is all you will need, convention will take care of wiring up the "CancelCommand" in your viewmodel to the control thru binding that is built into CM. Effectively you have broken the mechanic which your "double" binding of the name to command... Essentially you don't need to set anything to Command at all with conventions that CM already takes care of with smoke and mirrors for you.

Aside from that also be thinking of guard properties if necessary probably not necessary in this case, but creating a bool property with "Can" as part of the prefix of the property tells CM hey we have something to check before we are allowing the button to be enabled...

e.g. CanCancelCommand , CanSubmit, etc.


hth

Morgan

New Post: [WP8] Implementing simple loading overlay

$
0
0
me personally I wouldn't do with a popupoverly using windowmanager, but have something on the shell of your Wp8 that can popup based on an event sent from IEventAggregator? All it would is some border or grid with an opacity and a textblock. AppBar is appbar it might work this case to have the overlay at such a location that it will cover the appbar or use BindableAppbar and tell it to be hidden (design choice?).

New Post: Unhandled Exception in Boostrapper

Created Unassigned: MultiThreading Unhandled Exception not caught in Boostrapper [356]

$
0
0
Overriding the OnUnhandledException doesn't seem to work for exceptions raised from within spawned threads.

I verified this by raising an exception from the UI thread. That is caught as expected. Any workarounds that do not require me to change my application structure?

Commented Unassigned: MultiThreading Unhandled Exception not caught in Boostrapper [356]

$
0
0
Overriding the OnUnhandledException doesn't seem to work for exceptions raised from within spawned threads.

I verified this by raising an exception from the UI thread. That is caught as expected. Any workarounds that do not require me to change my application structure?
Comments: The OnUnhandledException function is only called when an exception is raised on the dispatcher, since it hooks the event ```C# Application.DispatcherUnhandledException ``` In case of exceptions raised in tasks, other threads, or generally outside of the dispatcher, OnUnhandledException is not called. It is up to you to handle such exceptions, and act as needed. Mostly, AppDomain and unobserved Task exceptions are enough, so in the Bootstrapper ctor (or static ctor), you can hook these events: ```C# AppDomain.CurrentDomain.UnhandledException += OnCurrentDomainUnhandledException; TaskScheduler.UnobservedTaskException += OnTaskSchedulerUnobservedTaskException; ```

New Post: Multiple Views to a viewmodel mapping - not working

$
0
0
Have a Viewmodel - ElasticityCurvesViewModel.cs under namespace PO.ViewModels.Historical under Historical folder.
Now I need to map this viewmodel to two views - ElasticityCurvesCurveView.xaml and ElasticityCurvesSelectionView.xaml under namespace PO.Views.Historical.

Please let me know the steps for the same.
The documentation on caliburn side is very confusing and its not working anyways.

Early response would be appreciated.

Commented Unassigned: MultiThreading Unhandled Exception not caught in Boostrapper [356]

$
0
0
Overriding the OnUnhandledException doesn't seem to work for exceptions raised from within spawned threads.

I verified this by raising an exception from the UI thread. That is caught as expected. Any workarounds that do not require me to change my application structure?
Comments: Right now I used ``` task.ContinueWith(..) ``` I'll try using ``` TaskScheduler.UnobservedTaskException ``` Thanks for the reply. Robin

Closed Unassigned: MultiThreading Unhandled Exception not caught in Boostrapper [356]

$
0
0
Overriding the OnUnhandledException doesn't seem to work for exceptions raised from within spawned threads.

I verified this by raising an exception from the UI thread. That is caught as expected. Any workarounds that do not require me to change my application structure?
Comments: Not an issue.

Source code checked in, #9bef6aec7efbc3fdb58354acea53361773818c29

$
0
0
prepare NET40 backport (not supported)

Source code checked in, #4e8d455e458810145ef61bd5eb13d682e877b726

New Post: Multiple Views to a viewmodel mapping - not working

$
0
0
<ContentControlcal:View.Context="{Binding CurrentView, Mode=TwoWay}"cal:View.Model="{Binding}"/>
CurrentView = string property in viewmodel that is set to what the name of the view you want to show.
CurrentView = "ElasticityCurvesSelectionView"; //etc
cal:View.Model = is assumed to be the currently active viewmodel.

Source code checked in, #b68bb2840fa06b4523801f0e4fe87d8735904831

Viewing all 1760 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>