Git Product home page Git Product logo

winrtmultibinding's People

Contributors

sdebruyn avatar verbon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

winrtmultibinding's Issues

UWA 10.0

Any chance this could be update to support Windows 10 UWA.

Thanks for a great package :)

NullReferenceException in object.GetType() when using ListView

When using the MV-converter in an UWP ListBox control everything works fine.
However, I switched to using a ListView where an "empty placeholder rectangle" is used in the virtualization mechanism the short time the actual ListViewItem (with it's binded data) is loaded. This is to make e.g. scrolling smoother. But then I get the following exception:

Exception {System.NullReferenceException: Object reference not set to an instance of an object.
at System.Object.GetType()
at WinRTMultibinding.Foundation.Data.Binding.CheckIfBindingModeIsValid(Object source, String path, BindingMode mode)
at WinRTMultibinding.Foundation.Data.Binding.SetBinding(Object source, Boolean shouldRaiseOnSourcePropertyValueChanged)
at WinRTMultibinding.Common.Extensions.CollectionExtensions.ForEach[T](IEnumerable1 source, Action1 action)
....

Well somehow it's logical, since the actual source that's going into the converter isn't loaded yet.

Any idea how to get around or solve this?

Trying to set UpdateSourceTrigger="Explicit" in order to prevent converter to run until source is loaded didn't help.

Many thanks.

Application has broken up when I'm using your sample

<TextBlock x:Name="txtContentMessage" Text="{Binding Text}" TextTrimming="CharacterEllipsis" 
                                       TextWrapping="Wrap" Foreground="{Binding Entities,ConverterParameter={Binding Text},Converter={StaticResource ChangedColorToUrlConverter},Mode=TwoWay}" MaxLines="3" Grid.Row="1"></TextBlock>

When I see your code:

<TextBlock x:Name="txtContentMessage" Text="{Binding Text}" TextTrimming="CharacterEllipsis" 
                                       TextWrapping="Wrap" MaxLines="3" Grid.Row="1">
                                    <m:MultiBindingHelper.MultiBindings>
                                        <m:MultiBindingCollection>
                                            <m:MultiBinding TargetProperty="Text">
                                                <m:Binding ConverterParameter="{Binding Text}" Converter="{StaticResource ChangedColorToUrlConverter}"></m:Binding>
                                                <m:Binding ConverterParameter="{Binding Entities}" Converter="{StaticResource ChangedColorToUrlConverter}"></m:Binding>
                                            </m:MultiBinding>
                                        </m:MultiBindingCollection>
                                    </m:MultiBindingHelper.MultiBindings>
                                </TextBlock>

And application has broken up when it was running.

Implement binding to attached properties

For example, multibinding to Canvas.Left property.
In SLMultiBinding it was done as

``
if (relay.TargetProperty.Contains("."))
{
// split to find the type and property name
string[] parts = relay.TargetProperty.Split('.');
targetType = Type.GetType("System.Windows.Controls." + parts[0] +
", System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e");
targetProperty = parts[1];
}
else
{
targetType = targetElement.GetType();
targetProperty = relay.TargetProperty;
}

      FieldInfo[] sourceFields = targetType.GetFields(DpFlags);//.OrderByDescending(x => x.Name).ToArray();
    FieldInfo targetDependencyPropertyField =
        sourceFields.First(i => i.Name == targetProperty + "Property");
    DependencyProperty targetDependencyProperty =
        targetDependencyPropertyField.GetValue(null) as DependencyProperty;

    // bind the ConvertedValue of our MultiBinding instance to the target property
    // of our targetElement
    Binding binding = new Binding("ConvertedValue")
    {
      Source = relay,
      Mode = relay.Mode
    };
    targetElement.SetBinding(targetDependencyProperty, binding);

``

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.