Noesis.Extended ?
Posted: 26 Aug 2015, 10:54
Hello,
i didn't use noesis since a while, i really missing something new here.
I just try to bind a text property from a usercontrol to a textblock in xaml
I did that lot of times before, but now it doesn't work any more !
It appear you change the code to accomplish it can you tell me more about the new method.
xaml
c#
Sorry if the question seem so stupid !
i didn't use noesis since a while, i really missing something new here.
I just try to bind a text property from a usercontrol to a textblock in xaml
I did that lot of times before, but now it doesn't work any more !
It appear you change the code to accomplish it can you tell me more about the new method.
xaml
Code: Select all
<Grid x:Name="LayoutRoot" TextElement.FontFamily="../Fonts/#Arial">
<Rectangle Fill="#FFF4F4F5" Stroke="Black"/>
<StackPanel Margin="172.967,107" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="Labeltxt" Text="{Binding ElementName=root, Path=Text}" TextWrapping="Wrap" FontSize="32" Margin="0,0,-0.001,0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"/>
<Button x:Name="AnnulerBtn" Content="Annuler" Style="{DynamicResource RedBtn}" VerticalAlignment="Top" FontSize="24" FontWeight="Bold" Foreground="White" Margin="0,5,0,0" Height="80"/>
<Button x:Name="ValiderBtn" Content="Valider" Style="{DynamicResource GreenBtn}" FontSize="24" FontWeight="Bold" Foreground="White" Margin="0,5,0,0" Height="80"/>
</StackPanel>
</Grid>
Code: Select all
using Noesis;
using System;
using UnityEngine;
[Noesis.UserControlSource("Assets/Gui/UserControls/PopUp.xaml")]
public class PopUpControl : UserControl
{
public DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string),
typeof(PopUpControl), new PropertyMetadata(""));
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
private Button Annulerbtn;
private Button.ClickHandler annulerEventHandler;
public Button.ClickHandler AnnulerEventHandler
{
set
{
annulerEventHandler = value;
if (Annulerbtn != null)
{
Annulerbtn.Click += annulerEventHandler;
}
}
}
private Button Validerbtn;
private Button.ClickHandler validerEventHandler;
public Button.ClickHandler ValiderEventHandler
{
set
{
validerEventHandler = value;
if (Validerbtn != null)
{
Validerbtn.Click += validerEventHandler;
}
}
}
public void OnPostInit()
{
Validerbtn = (Button)FindName("ValiderBtn");
Annulerbtn = (Button)FindName("AnnulerBtn");
Annulerbtn.Click += annulerEventHandler;
Validerbtn.Click += validerEventHandler;
}
}
Code: Select all
Exception: System.ApplicationException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: DependencyProperty 'Text' already registered to type 'PopUpControl'
at Noesis.Error.Check () [0x00020] in F:\2015_Affaire_Anthony\15_XXX Edf_Borne\Engine\Opinio\Assets\Plugins\NoesisGUI\Scripts\Core\NoesisError.cs:21
at Noesis.DependencyProperty.Noesis_RegisterDependencyProperty_String_ (IntPtr classType, IntPtr propertyName, IntPtr propertyMetada
Noesis.Error.Check () (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisError.cs:21)
Noesis.UIRenderer.Noesis_MouseButtonUp (Int32 rendererId, Single x, Single y, Int32 button) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRendererImports.cs:202)
Noesis.UIRenderer.ProcessEvent (UnityEngine.Event ev, Boolean enableKeyboard, Boolean enableMouse) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRenderer.cs:417)
NoesisGUIPanel.OnGUI () (at Assets/Plugins/NoesisGUI/Scripts/NoesisGUIPanel.cs:448)