开发者

Silverlight XAML databinding to a field

in the following code,

<riaControls:DomainDataSource AutoLoad="False" d:DesignData="{d:DesignInstance my:V_FinanceCalculatorDefaultValues, CreateList=true}" Height="0" LoadedData="v_FinanceCalculatorDefaultValuesDomainDataSource_LoadedData" Name="v_FinanceCalculato开发者_C百科rDefaultValuesDomainDataSource" QueryName="GetV_FinanceCalculatorDefaultValuesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:DomainServiceFinanceCalculatorDefaultValues />
            </riaControls:DomainDataSource.DomainContext>
            <riaControls:DomainDataSource.QueryParameters>
                <riaControls:Parameter ParameterName="modelId" Value="{Binding ElementName=modelIdTextBox, Path=Text}" />
            </riaControls:DomainDataSource.QueryParameters>
        </riaControls:DomainDataSource>

how do I set the value of the parameter to a field in the associated C# class?

public int SelectedModelUcConfigurator;

I tried something like this

 <riaControls:Parameter ParameterName="modelId" Value="{Binding ElementName=this, Path=SelectedModelUcConfigurator}" />

I realize this is something simple, but I'm new to WPF ... :-)

Thanks!


Try make a readonly property for SelectedModelUcConfigurator and bind to the property.

private int _selectedModelUcConfigurator; 

public int SelectedModelUcConfigurator
{ 
get { return _selectedModelUcConfigurator; } 
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜