Search Results

Search found 4490 results on 180 pages for 'binding'.

Page 19/180 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Hosting WCF service in IIS 7 (WAS) with net.tcp binding on TWO tcp ports

    - by Yuri
    By default IIS 7 Web site has net.tcp binding with "808:" binding information string. If i add another net.tcp binding with "xxx:" exception occurs: This collection already contains an address with scheme net.tcp. There can be at most one address per scheme in this collection. Parameter name: item How can i solve this problem and listen my service at TWO ports?

    Read the article

  • WCF binding programatically and adding metadata excange

    - by totem
    Hi, My problem is im trying to enable mex on a service that uses net.tcp binding. that binding is for localhost port 5000, when i want to enable mex on the same port, and have it avilable for http i have to enable the HttpGetEnabled on the Service host. All this works well but when i try to add the binding it fails becuase the binding is "net.tcp://localhost:5000/test". is there a way to enable mex on the same port but with a diffrent uri? Without enableing NetTcpPortSharing. I dont think the code is the issue since i can add the MEX on a diffrent port through the code an it works fine, the question is how to have net.tcp://localhost:5000/test as the WCF tcp based enpoint and net.tcp://localhost:5000/test/mex as the http mex endpoint that gives the WSDL for the TCP endpoint. thanks, Totem

    Read the article

  • Getting WCF Bindings and Behaviors from any config source

    - by cibrax
    The need of loading WCF bindings or behaviors from different sources such as files in a disk or databases is a common requirement when dealing with configuration either on the client side or the service side. The traditional way to accomplish this in WCF is loading everything from the standard configuration section (serviceModel section) or creating all the bindings and behaviors by hand in code. However, there is a solution in the middle that becomes handy when more flexibility is needed. This solution involves getting the configuration from any place, and use that configuration to automatically configure any existing binding or behavior instance created with code.  In order to configure a binding instance (System.ServiceModel.Channels.Binding) that you later inject in any endpoint on the client channel or the service host, you first need to get a binding configuration section from any configuration file (you can generate a temp file on the fly if you are using any other source for storing the configuration).  private BindingsSection GetBindingsSection(string path) { System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration( new System.Configuration.ExeConfigurationFileMap() { ExeConfigFilename = path }, System.Configuration.ConfigurationUserLevel.None); var serviceModel = ServiceModelSectionGroup.GetSectionGroup(config); return serviceModel.Bindings; }   The BindingsSection contains a list of all the configured bindings in the serviceModel configuration section, so you can iterate through all the configured binding that get the one you need (You don’t need to have a complete serviceModel section, a section with the bindings only works).  public Binding ResolveBinding(string name) { BindingsSection section = GetBindingsSection(path); foreach (var bindingCollection in section.BindingCollections) { if (bindingCollection.ConfiguredBindings.Count > 0 && bindingCollection.ConfiguredBindings[0].Name == name) { var bindingElement = bindingCollection.ConfiguredBindings[0]; var binding = (Binding)Activator.CreateInstance(bindingCollection.BindingType); binding.Name = bindingElement.Name; bindingElement.ApplyConfiguration(binding); return binding; } } return null; }   The code above does just that, and also instantiates and configures the Binding object (System.ServiceModel.Channels.Binding) you are looking for. As you can see, the binding configuration element contains a method “ApplyConfiguration” that receives the binding instance that needs to be configured. A similar thing can be done for instance with the “Endpoint” behaviors. You first get the BehaviorsSection, and then, the behavior you want to use.  private BehaviorsSection GetBehaviorsSection(string path) { System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration( new System.Configuration.ExeConfigurationFileMap() { ExeConfigFilename = path }, System.Configuration.ConfigurationUserLevel.None); var serviceModel = ServiceModelSectionGroup.GetSectionGroup(config); return serviceModel.Behaviors; }public List<IEndpointBehavior> ResolveEndpointBehavior(string name) { BehaviorsSection section = GetBehaviorsSection(path); List<IEndpointBehavior> endpointBehaviors = new List<IEndpointBehavior>(); if (section.EndpointBehaviors.Count > 0 && section.EndpointBehaviors[0].Name == name) { var behaviorCollectionElement = section.EndpointBehaviors[0]; foreach (BehaviorExtensionElement behaviorExtension in behaviorCollectionElement) { object extension = behaviorExtension.GetType().InvokeMember("CreateBehavior", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, behaviorExtension, null); endpointBehaviors.Add((IEndpointBehavior)extension); } return endpointBehaviors; } return null; }   In this case, the code for creating the behavior instance is more tricky. First of all, a behavior in the configuration section actually represents a set of “IEndpoint” behaviors, and the behavior element you get from the configuration does not have any public method to configure an existing behavior instance. This last one only contains a protected method “CreateBehavior” that you can use for that purpose. Once you get this code implemented, a client channel can be easily configured as follows  var binding = resolver.ResolveBinding("MyBinding"); var behaviors = resolver.ResolveEndpointBehavior("MyBehavior"); SampleServiceClient client = new SampleServiceClient(binding, new EndpointAddress(new Uri("http://localhost:13749/SampleService.svc"), new DnsEndpointIdentity("localhost"))); foreach (var behavior in behaviors) { if(client.Endpoint.Behaviors.Contains(behavior.GetType())) { client.Endpoint.Behaviors.Remove(behavior.GetType()); } client.Endpoint.Behaviors.Add(behavior); }   The code above assumes that a configuration file (in any place) with a binding “MyBinding” and a behavior “MyBehavior” exists. That file can look like this,  <system.serviceModel> <bindings> <basicHttpBinding> <binding name="MyBinding"> <security mode="Transport"></security> </binding> </basicHttpBinding> </bindings> <behaviors> <endpointBehaviors> <behavior name="MyBehavior"> <clientCredentials> <windows/> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel>   The same thing can be done of course in the service host if you want to manually configure the bindings and behaviors.  

    Read the article

  • Binding WPF menu items to WPF Tab Control Items collection

    - by William
    I have a WPF Menu and a Tab control. I would like the list of menu items to be generated from the collection of TabItems on my tab control. I am binding my tab control to a collection to generate the TabItems. I have a TabItem style that uses a ContentPresenter to display the TabItem text in a TextBlock. When I bind the tab items to my menu the menu items are blank. I assume the menu items are looking for the Header property of the TabItems which I am not using. Is there a workaround for my scenario? Is it possible to bind to the Header property of the tab item, when I do not know the number of tabs in advance? Below is a copy of my xaml declarations. Tab Control and items: <DataTemplate x:Key="ClosableTabItemTemplate"> <DockPanel HorizontalAlignment="Stretch"> <Button Command="{Binding Path=CloseWorkSpaceCommand}" Content="X" Cursor="Hand" DockPanel.Dock="Right" Focusable="False" FontFamily="Courier" FontSize="9" FontWeight="Bold" Margin="10,1,0,0" Padding="0" VerticalContentAlignment="Bottom" Width="16" Height="16" Background="Red" /> <ContentPresenter HorizontalAlignment="Center" Content="{Binding Path=DisplayName}"> <ContentPresenter.Resources> <Style TargetType="{x:Type TextBlock}"/> </ContentPresenter.Resources> </ContentPresenter> </DockPanel> </DataTemplate> <DataTemplate x:Key="WorkspacesTemplate"> <TabControl IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" ItemTemplate="{StaticResource ClosableTabItemTemplate}" Margin="10" Background="#4C4C4C"/> </DataTemplate> My Menu <Menu Background="Transparent"> <MenuItem Style="{StaticResource TabMenuButtonStyle}" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabControl}}, Path=Items}" ItemContainerStyle="{StaticResource TabMenuItem}"> </MenuItem> </Menu>

    Read the article

  • TwoWay Binding to ListBox SelectedItem on more than one list box in WPF

    - by Dan Bryant
    I have a scenario where I have a globally available Properties window (similar to the Properties window in Visual Studio), which is bound to a SelectedObject property of my model. I have a number of different ways to browse and select objects, so my first attempt was to bind them to SelectedObject directly. For example: <ListBox ItemsSource="{Binding ActiveProject.Controllers}" SelectedItem="{Binding SelectedObject, Mode=TwoWay}"/> <ListBox ItemsSource="{Binding ActiveProject.Machines}" SelectedItem="{Binding SelectedObject, Mode=TwoWay}"/> This works well when I have more than one item in each list, but it fails if a list has only one item. When I select the item, SelectedObject is not updated, since the list still thinks its original item was selected. I believe this happens because the two way binding simply ignores the update from source when SelectedObject is not an object in the list, leaving the list's SelectedItem unchanged. In this way, the bindings become out of sync. Does anybody know of a way to make sure the list boxes reset their SelectedItem when the SelectedObject is not in the list? Is there a better way to do this that doesn't suffer from this problem?

    Read the article

  • How to cancel binding ObjectDataSource ?

    - by nCdy
    CheckPara is my OnDataBinding procedure SqlDataSource1 is ObjectDataSource (it's only confusing name) Language is Nemerle, but if you know C# you can read it easy protected virtual CheckPara(_ : object, _ : System.EventArgs) : void { foreach(x is Parameter in SqlDataSource1.SelectParameters) when(x.DefaultValue=="") //Cancel binding } so how can I cancel binding when there is not fully configurated ObjectDataSource ? Or... how can I run binding only when I done with all parameters ?

    Read the article

  • WPF binding fails with custom add and remove accessors for INotifyPropertyChanged.PropertyChanged

    - by emddudley
    I have a scenario which is causing strange behavior with WPF data binding and INotifyPropertyChanged. I want a private member of the data binding source to handle the INotifyPropertyChanged.PropertyChanged event. I get some exceptions which haven't helped me debug, even when I have "Enable .NET Framework source stepping" checked in Visual Studio's options: A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll A first chance exception of type 'System.InvalidOperationException' occurred in PresentationCore.dll Here's the source code: XAML <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="TestApplication.MainWindow" DataContext="{Binding RelativeSource={RelativeSource Self}}" Height="100" Width="100"> <StackPanel> <CheckBox IsChecked="{Binding Path=CheckboxIsChecked}" Content="A" /> <CheckBox IsChecked="{Binding Path=CheckboxIsChecked}" Content="B" /> </StackPanel> </Window> Normal implementation works public partial class MainWindow : Window, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public bool CheckboxIsChecked { get { return this.mCheckboxIsChecked; } set { this.mCheckboxIsChecked = value; PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs("CheckboxIsChecked")); } } private bool mCheckboxIsChecked = false; public MainWindow() { InitializeComponent(); } } Desired implementation doesn't work public partial class MainWindow : Window, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged { add { lock (this.mHandler) { this.mHandler.PropertyChanged += value; } } remove { lock (this.mHandler) { this.mHandler.PropertyChanged -= value; } } } public bool CheckboxIsChecked { get { return this.mHandler.CheckboxIsChecked; } set { this.mHandler.CheckboxIsChecked = value; } } private HandlesPropertyChangeEvents mHandler = new HandlesPropertyChangeEvents(); public MainWindow() { InitializeComponent(); } public class HandlesPropertyChangeEvents : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public bool CheckboxIsChecked { get { return this.mCheckboxIsChecked; } set { this.mCheckboxIsChecked = value; PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs("CheckboxIsChecked")); } } private bool mCheckboxIsChecked = false; } }

    Read the article

  • WPF Applying a trigger on binding failure

    - by Aran Mulholland
    This question is a follow on from this one... I am binding to a heterogeneous collection of objects, not all objects have the same set of properties. I am doing this in a datagrid. I would like to gray out the cell if the binding fails. Is there a way to apply a trigger if a binding fails?

    Read the article

  • Why is shrink_to_fit non-binding?

    - by Roger Pate
    The C++0x FCD states in 23.3.6.2 vector capacity: void shrink_to_fit(); Remarks: shrink_to_fit is a non-binding request to reduce capacity() to size(). [Note: The request is non-binding to allow latitude for implementation-specific optimizations. —end note] Why is it non-binding, and what optimizations are intended to be allowed?

    Read the article

  • Listbox of comboboxes and binding them WPF

    - by Bashawy
    Hello, I have a situation where i have a listbox of comboboxes , mainly it binds to a bridge entity so the object contains foreign keys . What i need to do is that i need to bind the display of the combos to the respective entities and their value members to the foreign key values in the bridge entity that i bind the listbox to. the code i have now is : <ListBox Name="lstServices" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <Grid Margin="2" DataContext="{Binding ElementName=wndMain,Path=DataContext}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <ComboBox Name="cmbService" SelectedIndex="0" DisplayMemberPath="Name" SelectedValuePath="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=FK_ServiceID}" ItemsSource="{Binding Path=AllServices}" Grid.Column="0"></ComboBox> <ComboBox Name="cmbService_Role" Margin="2,0,0,0" SelectedValuePath="{Binding Path=FK_ServiceRoleID}" DisplayMemberPath="Name" ItemsSource="{Binding Path=AllService_Roles}" Grid.Column="1"></ComboBox> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> I could manage to display the values that i needed but since the List Item context changed i can't get to the listbox itemSource . Any help is appreciated Bishoy

    Read the article

  • Get the value for a WPF binding

    - by Jose
    Ok, I didn't want a bunch of ICommands in my MVVM ViewModels so I decided to create a MarkupExtension for WPF that you feed it a string(the name of the method), and it gives you back an ICommand that executes the method. here's a snippet: public class MethodCall : MarkupExtension { public MethodCall(string methodName) { MethodName = methodName; CanExecute = "Can" + methodName; } public override object ProvideValue(IServiceProvider serviceProvider) { Binding bin= new Binding { Converter = new MethodConverter(MethodName,CanExecute) }; return bin.ProvideValue(serviceProvider); } } public class MethodConverter : IValueConverter { string MethodName; public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //Convert to ICommand ICommand cmd = ConvertToICommand(); if (cmd == null) Debug.WriteLine(string.Format("Could not bind to method 'MyMethod' on object",MethodName)); return cmd; } } It works great, except when the binding fails(e.g. you mistype). When you do this in xaml: {Binding MyPropertyName} you see in the output window whenever the binding fails. and it tells you the propertyName the Type name etc. The MethodConverter Class can tell you the name of the method that failed, but it can't tell you the source object type. Because the value will be null. I can't figure out how to store the source object type so for the following class public class MyClass { public void MyMethod() { } } and the following xaml: <Button Command={d:MethodCall MyMethod}>My Method</Button> It currently says: "Could not bind to method 'MyMethod' on object but I would like it to say: "Could not bind to method 'MyMethod' on object MyClass Any ideas?

    Read the article

  • WPF TexBox TwoWay Binding Problem when ValidationRules used

    - by ignis
    I seem to have a problem with TwoWay DataBinding - my application has a window with a bunch of textboxes that allow to edit values of the properties they are bound to. Everything works well except for textboxes that also have a validation rule defined, in which case no text is displayed in the textbox when the window opens (binding back-to-source still works fine for those). If I remove Validation rule, everything's back to normal. I searched for an answer to this for a few hours now, but somehow did not even find anyone else complaining of the same issue. I am completely new to WPF, and I am sure it is just a silly mistake I have somewhere in my code... I will greatly appreciate any feedback... <TextBox Margin="40,2,20,0" Grid.Column="0" Grid.Row="1" Background="#99FFFFFF" > <Binding Path="LastName" Mode="TwoWay" ValidatesOnDataErrors="true" UpdateSourceTrigger="LostFocus" > <Binding.ValidationRules> <validation:StringNameValidationRule /> </Binding.ValidationRules> </Binding> </TextBox>

    Read the article

  • SL4 - Binding DataGridTextColumn to a property

    - by Brent
    I have a DataGrid. In the DataGrid's AutoGeneratingColumn event I have some code that looks like this: if (e.Property.Name.Contains("MetaData")) { var descCol = new DataGridTextColumn(e.Property); var bnd = new Binding("Description"); bnd.Mode = BindingMode.TwoWay; descCol.Binding = bnd; e.Column = descCol; e.Column.Header = "Description"; return; } The column binds to a type MetaData which has a string property named Description that I would like displayed in my DataGrid. So far I've been unable to get the value of the Description property to display in my DataGrid. I think the path I am passing into the Binding constructor might be incorrect. I've tried "MetaData.Description" as well and it doesn't work either. Can anyone help me properly set up the binding on my DataGridTextColumn?

    Read the article

  • ag_e_parser_bad_property_value Silverlight Binding Page Title

    - by zXynK
    XAML: <navigation:Page ... Title="{Binding Name}"> C# public TablePage() { this.DataContext = new Table() { Name = "Finding Table" }; InitializeComponent(); } Getting a ag_e_parser_bad_property_value error in InitializeComponent at the point where the title binding is happening. I've tried adding static text which works fine. If I use binding anywhere else eg: <TextBlock Text="{Binding Name}"/> This doesn't work either. I'm guessing it's complaining because the DataContext object isn't set but if I put in a break point before the InitializeComponent I can confirm it is populated and the Name property is set. Any ideas?

    Read the article

  • DataTrigger with Value Binding

    - by plotnick
    Why this doesn't work? <Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=Asset}" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=CurrentAsset}"> <Setter Property="Background" Value="Red" /> </DataTrigger> </Style.Triggers>

    Read the article

  • how to reapply knockout binding

    - by MikeW
    Currently I have a knockout binding that stripes rows in a list which works fine ko.bindingHandlers.stripe = { update: function (element, valueAccessor, allBindingsAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); //creates the dependency var allBindings = allBindingsAccessor(); var even = allBindings.evenClass; var odd = allBindings.oddClass; //update odd rows $(element).children(":nth-child(odd)").addClass(odd).removeClass(even); //update even rows $(element).children(":nth-child(even)").addClass(even).removeClass(odd); ; } } Triggered from <button data-bind="click: addWidget" style="display:none">Add Item</button> The problem I have is when reloading data from the server , I call addWidget() manually in the view model the stripe binding handler is not applied - all rows appear as same color, if I click the html button then the binding happens and stripes appear var ViewModel = function() { self.addWidget(); }); Is it possible to reapply this custom binding manually in js? Thanks Edit: The stripe binding gets applied like so <div data-bind="foreach: widgets, stripe: widgets, evenClass: 'light', oddClass: 'dark'">

    Read the article

  • ValueConverter not being invoked in DataTemplate binding

    - by unforgiven3
    I have a ComboBox that uses a DataTemplate. The DataTemplate contains a binding which uses an IValueConverter to convert an enumerated value into a string. The problem is that the value converter is never invoked. This is my XAML: <ComboBox ItemsSource="{Binding Path=StatusChoices, Mode=OneWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource StatusToTextConverter}}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> Is my binding not correct? I thought this is how one implicitly binds to the value a DataTemplate is presenting. Am I wrong?

    Read the article

  • Learn Fundamentals of Silverlight 4 Data Binding

    - by Eric J.
    I'm just starting to work with Silverlight (no WPF experience either) and am having a difficult time finding a source that provides a full explanation of Data Binding. There is absolutely no lack of tutorials (starting with the ones on Silverlight.net or Scott Gu's blogs), but everything I have found is "by example". Is there a resource that explains how data binding works in Silverlight, from a Fundamental/Conceptual perspective, and provides end-to-end coverage of data binding features? The desire for a more fundamental source of information is driven by a number of questions that came up this afternoon in reviewing tutorials and writing sample apps, such as: Why can't I bind the value of a slider like this?: Value="{Binding=Age, Mode=TwoWay}" where Age refers to an int property in the object data context I bind in code-behind (the Visual Studio error message is Expected '[]'. How do I use the DataContext property in VS 2010? What's a Path, Relative Source, Static Source, ...?

    Read the article

  • Stored procedures vs. parameter binding

    - by Gagan
    I am using SQL server and ODBC in visual c++ for writing to the database. Currently i am using parameter binding in SQL queries ( as i fill the database with only 5 - 6 queries and same is true for retrieving data). I dont know much about stored procedures and I am wondering how much if any performance increase stored procedures have over parameter binding as in parameter binding we prepare the query only once and just execute it later in the program for diferent set of values of variables.

    Read the article

  • Getting value of "System.Windows.Controls.TextBlock" when binding to Silverlight ComboBox

    - by sipwiz
    I'm attempting to use a Silverlight ComboBox with a static list of elements in a very simple binding scenario. The problem is the selected item is not returning me the Text of the TextBlock within the ComboBox and is instead returning "System.Windows.Controls.TextBlock". My XAML is: <ComboBox SelectedValue="{Binding Country, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"> <TextBlock FontSize="11" Text="Afghanistan" /> <TextBlock FontSize="11" Text="Albania" /> <TextBlock FontSize="11" Text="Algeria" /> </ComboBox> In my C# file I'm binding to the ComboBox using: Customer customer = new Customer() { Country = "Albania" }; DataContext = customer; The binding does not result in Albania as the selected country and updating the ComboBox choice results in the Country being set to "System.Windows.Controls.TextBlock". I've tried fiddling around with DisplayMemberPath and SelectedValuePath but haven't found the answer. I suspect it's something really simple I'm missing.

    Read the article

  • Tag property null when data binding

    - by rotary_engine
    Can anyone see what is wrong with this? The Tag property is returning null however the Binding for Id property is definately returning an int value. <ListBox ItemsSource="{Binding ElementName=myDomainDataSource, Path=Data}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Id, Mode=OneWay}" /> <HyperlinkButton Content="Edit" Tag="{Binding ElementName=Id, Mode=OneWay}" Click="Edit_Click" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> and then... private void Edit_Click(object sender, RoutedEventArgs e) { ContentControl c = sender as ContentControl; // exception - c.Tag is null int id = (int)c.Tag; } The Id property is showing a value on the UI, but doesn't seem to be getting stored in the buttons Tag property.

    Read the article

  • Silverlight: Why doesn't this binding expression work?

    - by Rosarch
    I'm having difficulty with a binding expression in Silverlight 3 for the Windows Phone 7. <Grid x:Name="LayoutRoot" Background="Transparent"> <controls:Pivot ItemsSource="{Binding SectionViewModels}"> <!-- ... --> <controls:Pivot.ItemTemplate> <DataTemplate> <Grid> <!-- this is the troublesome binding --> <TextBlock Style="{StaticResource disabledText}" Visibility="{Binding ElementName=LayoutRoot, Path=DataContext.NoStoryContent}"> Do you have a network connection? </TextBlock> <!-- ... --> The style, in app.xaml: <Style x:Key="disabledText" TargetType="TextBlock"> <Setter Property="Foreground" Value="{StaticResource PhoneDisabledBrush}" /> <Setter Property="TextWrapping" Value="Wrap" /> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}" /> </Style> Code behind: public Visibility NoStoryContent { get { // trivial return value for debugging // no breakpoint here is hit return Visibility.Collapsed; } } public Sections() { InitializeComponent(); LayoutRoot.DataContext = this; } What am I doing wrong here? I suspect I have a mistake in the binding expression, but I'm not sure where.

    Read the article

  • WPF Binding to a viewmodel

    - by user832747
    I'm simply binding a WPF DataGridTextColumn with a binding to my grid rows. <DataGridTextColumn Header="Name" Binding="{Binding Name}" /> I've bound to my row view models. The Name property has a PRIVATE setter. public string Name { get { return _name; } private set { _name = value; } } Shouldn't the datagrid prevent me from accessing the private setter? The grid allows me to access it. I swear it never used to, unless I'm forgetting something?

    Read the article

  • WPF: Is it possible to add or modify bindings via styles or something similar?

    - by Eamon Nerbonne
    I'm still learning the WPF ropes, so if the following question is trivial or my approach wrong-headed, please do speak up... I'm trying to reduce boilerplate and it sounds like styles are a common way to do so. In particular: I've got a bunch of fairly mundane data-entry fields. The controls for these fields have various properties I'd like to set based on the target of the binding - pretty normal stuff. However, I'd also like to set properties of the binding itself in the style to avoid repetitiveness. For example: <TextBox Style="{StaticResource myStyle}"> <TextBox.Text> <Binding Path="..." Source="..." ValidatesOnDataErrors="True" ValidatesOnExceptions="True" UpdateSourceTrigger="PropertyChanged"> </Binding> </TextBox.Text> </TextBox> Now, is there any way to use styling - or some other technique to write the previous example somewhat like this: <TextBox Style="{StaticResource myStyle}" Text="{Binding Source=... Path=...}/> That is, is there any way to set all bindings that match a particular selection (here, on controls with the myStyle style) to validate data and to use a particular update trigger? Is it possible to template or style bindings themselves? Alternatively, is it possible to add the binding in the style itself? Clearly, the second syntax is much, much shorter and more readable, and I'd love to be able to get rid of other similar boilerplate to keep my UI code comprehensible to myself :-).

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >