Click here to Skip to main content
15,908,841 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: It takes some long time to open my Silverlight web site at 1st visit Pin
SledgeHammer0126-Feb-11 17:36
SledgeHammer0126-Feb-11 17:36 
GeneralRe: It takes some long time to open my Silverlight web site at 1st visit Pin
Jun Du27-Feb-11 4:47
Jun Du27-Feb-11 4:47 
AnswerRe: It takes some long time to open my Silverlight web site at 1st visit Pin
Abhinav S27-Feb-11 22:20
Abhinav S27-Feb-11 22:20 
Question"Protection error - Debugger Detected" when using MediaElement Pin
Dave Midgley25-Feb-11 23:35
Dave Midgley25-Feb-11 23:35 
AnswerRe: "Protection error - Debugger Detected" when using MediaElement Pin
Vimalsoft(Pty) Ltd1-Mar-11 1:35
professionalVimalsoft(Pty) Ltd1-Mar-11 1:35 
GeneralRe: "Protection error - Debugger Detected" when using MediaElement Pin
Dave Midgley1-Mar-11 2:27
Dave Midgley1-Mar-11 2:27 
GeneralRe: "Protection error - Debugger Detected" when using MediaElement Pin
Dave Midgley4-Mar-11 1:36
Dave Midgley4-Mar-11 1:36 
QuestionBinding to static functions/properties Pin
zagitta25-Feb-11 11:45
zagitta25-Feb-11 11:45 
Hello CP, a few days ago I read a very interesting article about using XAML differently (And Now for XAML Completely Different) which I thought was a really cool way to use the XamlReader so I decided to implement a behaviour tree this way because I'm currently toying around with some game AI logic.
I've implemented all the behavior tree specific logic now however I'm stuck with how to bind the XAML together with the game lib to execute different functions and check for different conditions.

Here's an example of what my XAML looks like for a small behavior tree which doesn't work:

<Root 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns="clr-namespace:XamlBT.BT;assembly=XamlBT"    
    >
    
    <Root.Child>
        <Sequence>
                <Execute Function="{d:Binding StaticFuncs.Func}" />
        </Sequence>
    </Root.Child>
    
    <Root.Condition>
        <IfNot State="{d:Binding StaticFuncs.B}"/>
    </Root.Condition>
</Root>


and my Execute class looks like this:

public class Execute : DependencyObject, INode
    {
        public bool Evaluate()
        {
            if (Function != null)
            {
                    return Function();
            }
            return false;
        }

        public int Priority { get; set; }

        public Func<bool> Function
        {
            get { return (Func<bool>)GetValue(StateProperty); }
            set { SetValue(StateProperty, value); }
        }
        public static readonly DependencyProperty StateProperty = DependencyProperty.Register(
          "Function", typeof(Func<bool>), typeof(Execute), new PropertyMetadata(null));

    }


Right now the above code fails without ever resolving any of the properties

What I would like to be able todo is to bind a static methode which returns a bool and takes no parameters (or at the very least a static Func<bool> property but that is less desirable because it means repetetive code) to a Execute node's delegate or Func<bool> property so i would avoid lots wrapping functions into node types... Anyone that have a solution to my problem or maybe even a completly different aproach? Smile | :)

Thanks in advance and sorry for the rather bad English, especially the explenation because English is not my native language and the kind of English i'm used to talking doesn't involve explaining code intentions D'Oh! | :doh:
QuestionRefresh the Cache on Client. Pin
dbrenth25-Feb-11 5:34
dbrenth25-Feb-11 5:34 
AnswerRe: Refresh the Cache on Client. Pin
Mycroft Holmes25-Feb-11 18:30
professionalMycroft Holmes25-Feb-11 18:30 
QuestionPage Navigation Using "Silverlight Application" project type Pin
Sunasara Imdadhusen25-Feb-11 1:15
professionalSunasara Imdadhusen25-Feb-11 1:15 
AnswerRe: Page Navigation Using "Silverlight Application" project type Pin
Pete O'Hanlon25-Feb-11 1:22
mvePete O'Hanlon25-Feb-11 1:22 
AnswerRe: Page Navigation Using "Silverlight Application" project type Pin
Sunasara Imdadhusen25-Feb-11 2:37
professionalSunasara Imdadhusen25-Feb-11 2:37 
GeneralRe: Page Navigation Using "Silverlight Application" project type Pin
Pete O'Hanlon25-Feb-11 2:55
mvePete O'Hanlon25-Feb-11 2:55 
GeneralRe: Page Navigation Using "Silverlight Application" project type Pin
Sunasara Imdadhusen25-Feb-11 5:02
professionalSunasara Imdadhusen25-Feb-11 5:02 
GeneralRe: Page Navigation Using "Silverlight Application" project type Pin
Pete O'Hanlon1-Mar-11 6:29
mvePete O'Hanlon1-Mar-11 6:29 
QuestionQuestion about MEFedMVVM Pin
wasimsharp24-Feb-11 5:35
wasimsharp24-Feb-11 5:35 
AnswerRe: Question about MEFedMVVM Pin
Mycroft Holmes24-Feb-11 12:11
professionalMycroft Holmes24-Feb-11 12:11 
AnswerRe: Question about MEFedMVVM Pin
_Maxxx_24-Feb-11 13:19
professional_Maxxx_24-Feb-11 13:19 
GeneralRe: Question about MEFedMVVM Pin
Mycroft Holmes24-Feb-11 14:00
professionalMycroft Holmes24-Feb-11 14:00 
GeneralRe: Question about MEFedMVVM Pin
_Maxxx_24-Feb-11 15:10
professional_Maxxx_24-Feb-11 15:10 
GeneralRe: Question about MEFedMVVM Pin
Mycroft Holmes24-Feb-11 15:55
professionalMycroft Holmes24-Feb-11 15:55 
GeneralRe: Question about MEFedMVVM Pin
_Maxxx_24-Feb-11 17:18
professional_Maxxx_24-Feb-11 17:18 
GeneralRe: Question about MEFedMVVM Pin
wasimsharp24-Feb-11 19:39
wasimsharp24-Feb-11 19:39 
AnswerRe: Question about MEFedMVVM Pin
Pete O'Hanlon24-Feb-11 22:19
mvePete O'Hanlon24-Feb-11 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.