user2970840
user2970840

Reputation: 1361

How to use TargetNullValue in Windows Phone 8?

I want to assign a place holder, if binding value is null. the answer is TargetNullValue, but I don't know how to use it practically!

here it says ImageSource is not valid:

<Image>
    <Image.Source>
        <Binding Path="ImageUri" >
            <Binding.TargetNullValue>
                <ImageSource>/Assets/PlaceHolder.png</ImageSource>
            </Binding.TargetNullValue>
        </Binding>
    </Image.Source>
</Image>

Upvotes: 0

Views: 444

Answers (1)

Ivan Crojach Karačić
Ivan Crojach Karačić

Reputation: 1911

I think I had once a similar problem and solved it like this

<Image Source="{Binding Path=ImageUri, TargetNullValue='/Assets/PlaceHolder.png'}" />

Upvotes: 3

Related Questions