How do I detect permission for a file in a partial trust application ?

This situation occurs when an assembly is used by both windows and XBAP application in a partial trust. The assembly might have permission when used through windows application and the same when used through XBAP application will throw a security exception. To prevent this situation, the permission for a file can be checked using the ‘Demand()’ method on the instance of the desired permission. If a file doesn’t have permission, the Demand() method throws a security exception, else it can be used by the partial trust application.

Can I add prerequisites in my ClickOnce deployment ?

Yes. ClickOnce allows you to add prerequisites in ClickOnce deployment. It should download the installer packages for those prerequisites to your development machine. When you publish the ClickOnce application, choose Download prerequisites from the same location as my application. An error will occur if the installer packages aren’t in the Packages folder. Reference link: https://docs.microsoft.com/en-us/visualstudio/deployment/how-to-include-prerequisites-with-a-clickonce-application

How to Get or Set a value that indicates whether to include the DataErrorValidationRule ?

Setting this property provides an alternative to use the DataErrorValidationRule element, explicitly. The DataErrorValidationRule is a built-in validation rule that checks for errors that are raised by the ‘IDataErrorInfo’ implementation of the source object. If an error is raised, the binding engine creates a ValidationError with the error and adds it to the ‘Validation.Errors’ collection of the bound element. The lack of an error clears this validation feedback, unless another rule raises a validation issue. This example shows how to implement validation logic on a custom object and then bind to it. You can provide validation logic on the business layer if your source object implements IDataErrorInfo, as in the following example. In the following example, the ‘text’ property of the textbox binds to the ‘Age’ property of the Person object which has been made available for binding through a resource declaration that is given in the x:Keydata. The ‘DataErrorValidationRule’ checks for the validation errors raised by the IDataErrorInfo implementation. [XAML] <TextBox Style='{StaticResource textBoxInError}’> <TextBox.Text> <!–By setting ValidatesOnExceptions to True, it checks for exceptions that are thrown during the update of the source property. An alternative syntax is to add <ExceptionValidationRule/> within the <Binding.ValidationRules> section.–> <Binding Path=’Age’ Source='{StaticResource data}’ ValidatesOnExceptions=’True’ UpdateSourceTrigger=’PropertyChanged’> <Binding.ValidationRules> <!–DataErrorValidationRule checks for validation errors raised by the IDataErrorInfo object.–> <!–Alternatively, you can set ValidationOnDataErrors=’True’ on the Binding.–> <DataErrorValidationRule/> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox>

How to pass a parameter to a function using ObjectDataProvider ?

A parameter can be passed to a function using the ‘MethodParameters’ of the ‘ObjectDataProvider’ class. The following XAML code snippet demonstrates how to pass parameters to a function using an ObjectDataProvider. [XAML] <ObjectDataProvider ObjectInstance='{StaticResource odp1}’ MethodName=’WeightOnPlanet’ x:Key=’odp2?> <ObjectDataProvider.MethodParameters> <system:Double>95</system:Double> </ObjectDataProvider.MethodParameters> </ObjectDataProvider>

How do I update the source as I type in a TextBox?

The source can be updated using the ‘UpdateSourceTrigger’ property of the TextBox. By default, the ‘UpdateSourceTrigger’ property is set to ’LostFocus’, i.e. the source is updated when the data-bound TextBox loses the focus. By setting the ‘UpdateSourceTrigger’ property to ’PropertyChanged’, the source will be updated as you type in a TextBox. In the following code snippet a TextBox’s ‘Text’ property is bound with the Button’s ‘Width’ property. On changing the Text in the TextBox, the Width of the Button is updated. [XAML] <Button Name=’hellobtn’ Content=’Hello’ Width=’150′ Height=’30’/> <TextBox Text='{Binding ElementName=hellobtn, Path=Width, Height=’20’ UpdateSourceTrigger=PropertyChanged}’/>