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

New Post: ListBox.SelectedItems convention

$
0
0
I have been using pmacnaughton modifications in my application (which is a WPF pane inside an Excel document customization). My users are reporting that the whole screen flickers in Excel 2010 when I update a large collection. In Excel 2013, I can see the selected cell flickers whilst the selected items are updated.

My Items/SelectedItems are bound to a ListBox (with a Checkbox). When I populate my Items collection (BindableCollection), I set IsNotifying to false, then I perform an AddRange before setting IsNotifying to true and calling Refresh. After setting my Items, I populate the SelectedItems (BindableCollection) using a similar method. It is this second action which causes the flicker - if I comment out that line, then no flicker.

I have tracked this down to the 'list.Add(item);' line from the above modifications - if I don't do this then again no flicker.
Is there a way to stop the screen flicker when binding Items/SelectedItems to a ListBox.

New Post: caliburn.micro serialization issue when implementing PropertyChangedBase

$
0
0
public class Person
{
public int Id {get;set;}
public string FirstName{get;set;}
...
}
The application contains a class called "Person". A "Person" object is serialized (JSON) and moved back and forth from client to server using simple REST protocal. The solution works fine without any problem.

Problem:

I have set a parent class "PropertyChangedBase" for "Person" in order to implement NotifyOfPropertyChanged().

public class Person : PropertyChangedBase
{
public int Id {get;set;}

private string _firstName;
public string FirstName
{
    get { return _firstName; }
    set
    {
        _firstName = value;
        NotifyOfPropertyChange(() => FirstName);
    }
}
...
}
But this time the properties of class "Person" has NULL values at receiving end.

I guess there is a problem with serialization / deserialization. This is only happens when implementing PropertyChangedBase.

Can anyone help me to overcome this issue?

New Post: Hybrid Example & WPF

New Post: Message.Attach not passing parameters by name

$
0
0
<TextBox x:Name="TemplateEmail" Grid.Row="1" Margin="0,5,0,0" IsEnabled="{Binding ElementName=EnviaEmail, Path=IsChecked}">
    <TextBox.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Cliente" cal:Message.Attach="[Click] = [Action ContextMenuCliente(TemplateEmail.Name, TemplateEmail.CaretIndex)]"  />
            <MenuItem Header="Contacto" cal:Message.Attach="[Click] = [Action ContextMenuContacto($source)]"  />
        </ContextMenu>
    </TextBox.ContextMenu>
</TextBox>
Greetings,

I'm using the code above to "mimic" Copy + Paste in MMV: i know the ViewModel property name (TemplateEmail.Name, know where the cursor is TemplateEmail.CaretIndex so i can now "paste" my text in the correct place.

However for some reason i'm simple getting null and 0 instead of the correct values. variables such as $view, $this, etc are working so it seems to be related to named FrameworkElements?

I know i can't pass a FrameworkElement as a parameter with Message.Attach but i assumed i could at least pass some specific properties?

Created Unassigned: Install Docs Broken [365]

$
0
0
On the Documentation Nuget page, the link referring to "With the latest version of Nuget installed" is broken - leads nowhere.

Next, create a new WPF application in VS. Go to package manager window and enter in the suggested command "Install-Package Caliburn.Micro.Start" and it fails with the following message:

PM> Install-Package Caliburn.Micro.Start
Attempting to resolve dependency 'Caliburn.Micro (= 2.0.2)'.
Install-Package : 'Caliburn.Micro' already has a dependency defined for 'Caliburn.Micro.Core'.
At line:1 char:1
+ Install-Package Caliburn.Micro.Start
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

PM>


Helpful. If you do "Install-Package Caliburn.Micro" then something installs, but it is missing BootStrapper and none of the existing tutorials on getting this working can be followed.

Are you guys aware that this doesn't install/work anymore? Is anyone maintaining this stuff??

New Post: ContextMenu not working

$
0
0
@badscooter's approach helped me as well, thank you!

New Post: Managing same view models and Views in assemblies of different versions.

$
0
0
Hello
first thanks for the very useful tool.

Now we stumbled over one issue, which we could not solve.

We are loading dynamically assemblies containing specific views using the "AssemblySource" type.

Our goal is to offer different versions of views in the same application. Each view is implemented in an appropriate assembly with the same name. We accomplish the loading with the standard .NET mechanism with strong naming and different assembly versions. This works very good as far as loading the assemblies and getting the appropriate view model over the IOC.

Now the problem: Since we use the same type names for the view models in the different assemblies with different version caliburn gets an problem when it tries to associate the view model with the appropriate view, since it exists in assemblies of different versions with the same name. An internal used dictionary of caliburn returns "Key already exists" error. when we try to load a second view model.

When we use different names for the view models and views it works perfectly. But this solution is not preferred, since versionmanagement in two places is needed (assembly version and type name of the view model and view)

Is there a possibility to intercept with the caliburn mechanism, which associates the view model with the view? This would give us the possibility to use the correct assembly, where the view model can find the view.
If not: would it be a feature caliburn can offer?

Any other ideas are appreciated?

Thanks
Jörg

New Post: Is there an agreed-upon "best practice" for PasswordBox binding?

$
0
0
If not supported why is this example touted on the http://caliburnmicro.com/ doc page? Sure would like to know how that can be made to work as I'm unable to do so.

<StackPanel>
<TextBox x:Name="Username" />
<PasswordBox x:Name="Password" />
<Button x:Name="Login" Content="Log in" />
</StackPanel>

New Post: How can I get PasswordBox to work?

$
0
0
On the http://caliburnmicro.com/ doc page the following example is given but I'm unable to set the related PasswordBox property though my Domain and User properties are set fine. Is there a certain CM version I need for my WPF program?

<StackPanel>
<TextBox x:Name="Username" />
<PasswordBox x:Name="Password" />
<Button x:Name="Login" Content="Log in" />
</StackPanel>

Thanks, Dave

New Post: PasswordBox validation

$
0
0
Please - where is the "validation recipe" is located?

New Post: How may I choose subscriber while publishing event using EventAggregator in Calirburn Micro?

$
0
0
Hi,

How may I choose subscriber while publishing event using EventAggregator in Calirburn Micro?

I have four subscribers for some particular message at single time but I want to send notification to one of them while publishing the message. Subscribers are generic here and I'm interested only in appropriate(one) subscriber suitable for the publisher type.

Thanks in advance.

New Post: Unable to invoke bootstrapper with out App.xaml.

$
0
0
Hi
Recently working on caliburn micro and want to create class libraries with caliburn micro and use them in another tool. But when i try to invoke bootstrpper object using the Start() it is not binding my views and viewmodel.
TestBootStrapper tb = new TestBootStrapper();
            tb.Start();
And i want to display it as showdialog but that is also not happening. Please guide me on this.
Is there any way to bootstrap with out App.Xaml ?

namespace xxxxxxx
{
public class TestBootStrapper : BootstrapperBase
{
    public TestBootStrapper():base(false)
    {
        StartRuntime();
         Start();

    }

    private CompositionContainer container;

    protected override void Configure()
    {
        container = new CompositionContainer(new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>()));

        CompositionBatch batch = new CompositionBatch();

        batch.AddExportedValue<IWindowManager>(new AppWindowManager());
        batch.AddExportedValue<IEventAggregator>(new EventAggregator());
        batch.AddExportedValue(container);

        container.Compose(batch);
    }

    protected override object GetInstance(Type serviceType, string key)
    {
        string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
        var exports = container.GetExportedValues<object>(contract);

        if (exports.Count() > 0)
        {
            return exports.First();
        }

        throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract));


    }


    protected override IEnumerable<Assembly> SelectAssemblies()
    {
        return new[] {
            Assembly.GetExecutingAssembly()
                        };
    }

    protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
    {
        base.OnStartup(sender, e);
        DisplayRootViewFor<MainViewModel>();

    }

}
}

New Post: BakButton change title Frame

$
0
0
Good morning I'm going crazy I can not figure out how to let my BackButton (SystemNavigationManager) I change the title of my frame, No MVVM you can follow this [guide](https: //msdn.microsoft.com/it-it/library/ windows / apps / mt465734.aspx), but with Caliburn can not figure out how to do and I can not find documentation.

New Post: SelectionChanged for DataGrid is being called multiple times after changing screen in conductor.

$
0
0
Hi,

We've a conductor with two screens being displayed alternatively. Screen 1 has DataGrid which is attached with a method in ViewModel using ActionMessage for SelectionChanged event. Screen 2 has very basic UI. We change the screen by setting ActiveItem property of conductor on some event. Screen 1 is default for conductor and it works fine on load.

Problem is that SelectionChanged for DataGrid is being called multiple(like 3 times if I set viewmodel to ActiveItem thrice) times after changing the screens. It seems to me like event subscribers are being added for SelectionChanged whenever screen 1’s viewmodel is set to ActiveItwe.

Could you please help and let me know how to avoid the situation?

Thanks in advance.

New Post: Caliburn, Xamarin and ETO

$
0
0
My company has an WPF application that uses Caliburn.

I am tasked with porting it to Mac / Linux.

Xamarin.Forms doesn't really do desktop yet, so there isn't any Xaml.

I found a great framework called ETO (https://github.com/picoe/Eto sorry if I am not supposed to mention github on codeplex).

I was wondering if it was even possible to modify / use caliburn when there isn't any Xaml to do the magic? Does Caliburn under the hood hook into source code somewhere or do something at runtime that could do the magic without the actual Xaml?

ETO is basic code based. You create all your controls in code.

If I could write that code in such a way that it produced whatever is needed for Caliburn to do its magic at runtime, I am hoping that would just work and I could share all my ViewModel and business code directly rather than having to port a bunch and not share.

New Post: Reusing ViewModel with single View-Instance

$
0
0
Hello,

I use an MEF exported ViewModel (ReportViewModel) multiple times in my application.
<ContentControl cal:View.Model="{Binding ReportVM}" />
As expected, the same instance of the ViewModel is always used.
But It seems that caliburn always create a new View instance.
How can I prevent caliburn from creating a new View instance?

Is this possible?

New Post: ☯amazing

New Post: ✈Re: have you heard the news?

$
0
0

Hey,

Have you already heard the news? Just check it out, you'll be amazedopen message

Yours faithfully, lars

Sent from Mail for Windows 10

New Post: Re: Re: that was unexpected

$
0
0

image

Hey friend,

I've found something really amazing, I didn't expect that stuff would be so cool, check it outmessage

Sincerely yours, lars

New Post: ✈need your help

$
0
0

image

Greetings!

I couldn't find some stuff so I decided to ask for your help, here's what I'm looking forview message

lars

Viewing all 1760 articles
Browse latest View live


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