This is a migrated thread and some comments may be shown as answers.

Problem with Custom DependencyProperty

0 Answers 38 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ENTERPRISE INTERNATIONAL SAS
Top achievements
Rank 1
ENTERPRISE INTERNATIONAL SAS asked on 10 Sep 2010, 08:58 PM
Hi!

I have a DLL assembly referenced into my project, this is a snapcode about a dependencyProperty named EsRegistroNuevo.

namespace App_WpfResources
{
public class App_PageKernel : PageFunction<object>
{
public static readonly DependencyProperty EsRegistroNuevoProperty = DependencyProperty.Register("EsRegistroNuevo", typeof(bool), typeof(App_PageKernel));

public bool EsRegistroNuevo
{
get { return (bool)GetValue(EsRegistroNuevoProperty); }
set { SetValue(EsRegistroNuevoProperty, value); }
}

MY main project can set EsRegistroNuevo = [true/false]; (this is a boolean property to set NewRecord state) and this main project has a details panel with textboxes. My intention is when I click on NewRecord Button, all textboxes got Empty automatically, so I made something like this:

1.<kernel:App_PageKernel <br>  x:Class="Solar.Formularios.Administracion.Sistema.frmModulos"<br>   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <br>  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" <br> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" <br> xmlns:d="http://schemas.microsoft.com/expression/blend/2008" <br>   xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" <br>  xmlns:kernel="clr-namespace:App_WpfResources;assembly=App_WpfResources" <br>    xmlns:master="clr-namespace:Solar.App_LocalResources.Templates" <br>    xmlns:Telerik_MaskedTextBox="clr-namespace:Telerik.Windows.Controls.MaskedTextBox;assembly=Telerik.Windows.Controls.Input"<br>  xmlns:cl="clr-namespace:App_ControlLibrary;assembly=App_ControlLibrary"<br>    xmlns:wex="clr-namespace:Wex.Lib.Interactions;assembly=Wex.Lib"<br>    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"<br>    Title="Modulos" Width="1280" Height="800" Loaded="Page_Loaded"><br><p>...  <br></p><p><ScrollViewer x:Name="pnlContenedorContenido" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" RenderTransformOrigin="0.52,0.349"><br>        <Grid HorizontalAlignment="Stretch" Height="800" VerticalAlignment="Stretch" Width="1280"><br>            <i:Interaction.Triggers><br>                <wex:EventTrigger ElementName="btnInsertar" EventName="Click"><br>                    <wex:PropertyAction Property="Text" Value="" TargetName="txtEjecutable"><br>                        <wex:PropertyAction.Conditions><br>                            <wex:InvokingConditions><br>                                <wex:InvokingCondition Property="kernel:App_PageKernel.EsRegistroNuevoProperty" Value="True"/><br>                            </wex:InvokingConditions><br>                        </wex:PropertyAction.Conditions><br>                    </wex:PropertyAction><br>                </wex:EventTrigger><br></p><p>...</p><p><br><StackPanel x:Name="pnlBarraHerramientasDetalle" Height="55" Margin="0,0,3,0" Width="416"><br>                        <telerik:RadToolBar x:Name="tlbDetalle" Orientation="Horizontal" OverflowButtonVisibility="Hidden" Height="54" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BorderBrush="#FFE9F2FF" BorderThickness="1" HorizontalAlignment="Right" Width="413"><br>                        <Button x:Name="btnInsertar" Tag="btnInsertar" Click="btnToolBar_Click"><br>                             <Image Source="/App_LocalResources/Imagenes/HojaNueva.png" Stretch="UniformToFill" Height="41" Width="41" /><br>                          </Button><br>                      </telerik:RadToolBar><br>                    </StackPanel><br>                 <Grid x:Name="pnlDetalle" Height="249" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"><br>                     <Grid Height="39" Margin="38,18,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="159"><br><Label x:Name="lblEjecutable" Content="Ejecutable" Margin="21,121,0,0" VerticalAlignment="Top" Width="77" Height="27"/><br>                     <TextBox x:Name="txtEjecutable" Style="{StaticResource Estilo1TextBox}" Text="{Binding ElementName=grdGridConsulta, Path=SelectedItem.CA003, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" HorizontalAlignment="Left" Margin="102,121,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TabIndex="2" Width="301" Height="27"/></p>

...

My point is: wex:EventTrigger ElementName="btnInsertar" EventName="Click"> Catch Event Clik when button is pressed. this code:

wex:PropertyAction Property="Text" Value="" TargetName="txtEjecutable">
wex:PropertyAction.Conditions>
wex:InvokingConditions>
wex:InvokingCondition Property="kernel:App_PageKernel.EsRegistroNuevoProperty" Value="True"/>

Evaluates if kernel:App_PageKernel.EsRegistroNuevoProperty is true, then txtEjecutable is empty. But this is not working. I tried putting conditions on custom <Style, but not works. I need help

thanks

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
ENTERPRISE INTERNATIONAL SAS
Top achievements
Rank 1
Share this question
or