UE4
Topic Author
Posts: 62
Joined: 29 Dec 2017, 06:32

[UE4] Error log, but xaml runs well

12 Apr 2018, 10:24

Hi,
I use the lastest plugin with UE4.19 do some work, and got error log:


LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=MapIconList, Source=null(''), Target=ItemsControl('MapIconList'), TargetProperty=ItemsControl.ItemsSource
LogNoesis: Error: Binding failed: Path=Offset.X, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Left
LogNoesis: Error: Binding failed: Path=Offset.X, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Left
LogNoesis: Error: Binding failed: Path=Offfset.Y, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Top
LogNoesis: Error: Binding failed: Path=Offfset.Y, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Top
LogNoesis: Error: Binding failed: Path=Offset.X, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Left
LogNoesis: Error: Binding failed: Path=Offset.X, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Left
LogNoesis: Error: Binding failed: Path=Offfset.Y, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Top
LogNoesis: Error: Binding failed: Path=Offfset.Y, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Top
LogNoesis: Error: Binding failed: Path=Offset.X, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Left
LogNoesis: Error: Binding failed: Path=Offset.X, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Left
LogNoesis: Error: Binding failed: Path=Offfset.Y, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Top
LogNoesis: Error: Binding failed: Path=Offfset.Y, Source=.?AVBaseComponent@Noesis@@(''), Target=ContentPresenter(''), TargetProperty=Canvas.Top
LogNoesis: Error: Cannot find source for binding with reference 'ElementName=IconTex'
LogNoesis: Error: Binding failed: Path=IsMouseOver, Source=null(''), Target=Popup('IconTips'), TargetProperty=Popup.IsOpen
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.X, Source=null(''), Target=Border('IconTex'), TargetProperty=FrameworkElement.Width
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.Y, Source=null(''), Target=Border('IconTex'), TargetProperty=FrameworkElement.Height
LogNoesis: Error: Binding failed: Path=Angle, Source=null(''), Target=RotateTransform(''), TargetProperty=RotateTransform.Angle
LogNoesis: Error: Binding failed: Path=IconTexture, Source=null(''), Target=ImageBrush(''), TargetProperty=ImageBrush.ImageSource
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.X, Source=null(''), Target=Border('Icon'), TargetProperty=FrameworkElement.Width
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.Y, Source=null(''), Target=Border('Icon'), TargetProperty=FrameworkElement.Height
LogNoesis: Error: Cannot find source for binding with reference 'ElementName=IconTex'
LogNoesis: Error: Binding failed: Path=IsMouseOver, Source=null(''), Target=Popup('IconTips'), TargetProperty=Popup.IsOpen
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.X, Source=null(''), Target=Border('IconTex'), TargetProperty=FrameworkElement.Width
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.Y, Source=null(''), Target=Border('IconTex'), TargetProperty=FrameworkElement.Height
LogNoesis: Error: Binding failed: Path=Angle, Source=null(''), Target=RotateTransform(''), TargetProperty=RotateTransform.Angle
LogNoesis: Error: Binding failed: Path=IconTexture, Source=null(''), Target=ImageBrush(''), TargetProperty=ImageBrush.ImageSource
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.X, Source=null(''), Target=Border('Icon'), TargetProperty=FrameworkElement.Width
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.Y, Source=null(''), Target=Border('Icon'), TargetProperty=FrameworkElement.Height
LogNoesis: Error: Cannot find source for binding with reference 'ElementName=IconTex'
LogNoesis: Error: Binding failed: Path=IsMouseOver, Source=null(''), Target=Popup('IconTips'), TargetProperty=Popup.IsOpen
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.X, Source=null(''), Target=Border('IconTex'), TargetProperty=FrameworkElement.Width
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.Y, Source=null(''), Target=Border('IconTex'), TargetProperty=FrameworkElement.Height
LogNoesis: Error: Binding failed: Path=Angle, Source=null(''), Target=RotateTransform(''), TargetProperty=RotateTransform.Angle
LogNoesis: Error: Binding failed: Path=IconTexture, Source=null(''), Target=ImageBrush(''), TargetProperty=ImageBrush.ImageSource
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.X, Source=null(''), Target=Border('Icon'), TargetProperty=FrameworkElement.Width
LogNoesis: Cannot find source DataContext for binding
LogNoesis: Error: Binding failed: Path=IconSize.Y, Source=null(''), Target=Border('Icon'), TargetProperty=FrameworkElement.Height






<UserControl x:Class="GameGUI.MiniMapView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:GameGUI"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="400">


    <Grid>


        <ItemsControl x:Name="MapIconList" ItemsSource="{Binding MapIconList}">

            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas>
                        
                    </Canvas>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>


            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>

                        <Border x:Name="Icon" Width="{Binding IconSize.X}" Height="{Binding IconSize.Y}"
                                RenderTransformOrigin="0.5, 0.5" IsHitTestVisible="False">
                            <Border.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="{Binding Angle}"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Border.RenderTransform>
                            <Border.Background>
                                <ImageBrush ImageSource="{Binding IconTexture}"></ImageBrush>
                            </Border.Background>
                        </Border>

                        <Border x:Name="IconTex" Width="{Binding IconSize.X}" Height="{Binding IconSize.Y}"
                                RenderTransformOrigin="0.5, 0.5" Background="Transparent">

                        </Border>

                        <Popup x:Name="IconTips" IsOpen="{Binding ElementName=IconTex, Path=IsMouseOver, Mode=OneWay}"
                            Placement="MousePoint"  StaysOpen="False">
                            <TextBlock Text="{Binding Tips}"></TextBlock>
                           
                        </Popup>
                    </Grid>
                </DataTemplate>

            </ItemsControl.ItemTemplate>

            <ItemsControl.ItemContainerStyle>
                <Style>
                    <Setter Property="Canvas.Left" Value="{Binding Offset.X}"></Setter>
                    <Setter Property="Canvas.Top" Value="{Binding Offfset.Y}"></Setter>
                </Style>
            </ItemsControl.ItemContainerStyle>
        </ItemsControl>

    </Grid>
</UserControl>




USTRUCT(BlueprintType)
struct FMiniMapIcon
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int32 UniqueID;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		UTexture2D * IconTexture = nullptr;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		float IconScale = 1.f;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FVector2D IconSize;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FVector2D Offset;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FString Tips;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		float Angle = 0.f;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		bool bInteractable = false;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		bool bVisible = false;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FLinearColor DrawColor;
};


/**
 * 
 */
UCLASS(BlueprintType, Blueprintable)
class GAMEGUIMODULE_API UMiniMapViewModel : public UObject
{
	GENERATED_BODY()
public:
	UFUNCTION(BlueprintCallable)
		int32 FindMapIcon(int32 InUniqueID) const;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FVector2D MiniMapSize = FVector2D(300.f, 300.f);
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		TArray<FMiniMapIcon> MapIconList;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		UTexture2D* MapTexture;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		UTextureRenderTarget2D* RealTimeFogTexture;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int32 SelectedIndex = INDEX_NONE;

};


 
User avatar
hcpizzi
Site Admin
Posts: 213
Joined: 09 Feb 2012, 12:40

Re: [UE4] Error log, but xaml runs well

12 Apr 2018, 11:57

Hi,

Are you using SetDataContext in this XAML? Because in that case, when the View is created, the DataContext is created from the NoesisView, that doesn't have all those properties. Once SetDataContext is called all the Bindings should be correct. The same thing can happen when a NoesisView is destroyed.

I could add an entry to the log when SetDataContext is called to make it easier to spot these errors from real errors, or add a setting to the NoesisView to explicitly initialize the View.
 
UE4
Topic Author
Posts: 62
Joined: 29 Dec 2017, 06:32

Re: [UE4] Error log, but xaml runs well

12 Apr 2018, 14:45

Hi,

Are you using SetDataContext in this XAML? Because in that case, when the View is created, the DataContext is created from the NoesisView, that doesn't have all those properties. Once SetDataContext is called all the Bindings should be correct. The same thing can happen when a NoesisView is destroyed.

I could add an entry to the log when SetDataContext is called to make it easier to spot these errors from real errors, or add a setting to the NoesisView to explicitly initialize the View.
the NoesisInstance has nothing only for holding the Xaml file, I create NoesisInstance, ViewMode and SetDataContext in GameMode.

Who is online

Users browsing this forum: No registered users and 4 guests