Search Results

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

Page 13/180 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • jQuery date picker not persistant after AJAX

    - by ILMV
    So I'm using the jQuery date picker, and it works well. I am using AJAX to go and get some content, obviously when this new content is applied the bind is lost, I learnt about this last week and discovered about the .live() method. But how do I apply that to my date picker? Because this isn't an event therefore .live() won't be able to help... right? This is the code I'm using to bind the date picker to my input: $(".datefield").datepicker({showAnim:'fadeIn',dateFormat:'dd/mm/yy',changeMonth:true,changeYear:true}); I do not want to call this metho everytime my AJAX fires, as I want to keep that as generic as possible. Cheers :-) EDIT As @nick requested, below is my wrapper function got the ajax() method: var ajax_count = 0; function getElementContents(options) { if(options.type===null) { options.type="GET"; } if(options.data===null) { options.data={}; } if(options.url===null) { options.url='/'; } if(options.cache===null) { options.cace=false; } if(options.highlight===null || options.highlight===true) { options.highlight=true; } else { options.highlight=false; } $.ajax({ type: options.type, url: options.url, data: options.data, beforeSend: function() { /* if this is the first ajax call, block the screen */ if(++ajax_count==1) { $.blockUI({message:'Loading data, please wait'}); } }, success: function(responseText) { /* we want to perform different methods of assignment depending on the element type */ if($(options.target).is("input")) { $(options.target).val(responseText); } else { $(options.target).html(responseText); } /* fire change, fire highlight effect... only id highlight==true */ if(options.highlight===true) { $(options.target).trigger("change").effect("highlight",{},2000); } }, complete: function () { /* if all ajax requests have completed, unblock screen */ if(--ajax_count===0) { $.unblockUI(); } }, cache: options.cache, dataType: "html" }); } What about this solution, I have a rules.js which include all my initial bindings with the elements, if I were to put these in a function, then call that function on the success callback of the ajax method, that way I wouldn't be repeating code... Hmmm, thoughts please :D

    Read the article

  • How to make that the LanguageBinder take precedence over the DynamicBinder

    - by rudimenter
    Hi I Have a class which implement IDynamicMetaObjectProvider I implement the BindGetMember Method from DynamicMetaObject. Now when i Generate a dynamic Object and Access a property every call gets implicit passed through the BindGetMember Method. I want that at first the language Binder get his chance before my code comes in. It is somehow doable with "binder.FallbackGetMember" but i am not sure how the expression has to look like. I call here dynamic com=CommandFactory.GetCommand(); com.testprop; //expected: "test"; but "test2" comes back public class Command : System.Dynamic.IDynamicMetaObjectProvider { public string testprop { get { return "test"; } } public object GetValue(string name) { return "test2"; } System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { return new MetaCommand(parameter, this); } private class MetaCommand : System.Dynamic.DynamicMetaObject { public MetaCommand(Expression expression, Command value) : base(expression, System.Dynamic.BindingRestrictions.Empty, value) { } public override System.Dynamic.DynamicMetaObject BindGetMember(System.Dynamic.GetMemberBinder binder) { var self = this.Expression; var bag = (Command)base.Value; Expression target; target = Expression.Call( Expression.Convert(self, typeof(Command)), typeof(Command).GetMethod("GetValue"), Expression.Constant(binder.Name) ); var restrictions = BindingRestrictions .GetInstanceRestriction(self, bag); return new DynamicMetaObject(target, restrictions); } #endregion } }

    Read the article

  • Reducing WPF binding boilerplate with styles - updating the bindings themselves via styling?

    - 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? 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

  • Apprentissage de PySide, le binding Qt de Nokia pour Python, un article de Charles-Elie Gentil

    Bonjour, Vous trouverez ci-dessous le lien vers un tutoriel destiné à aider le programmeur Python à l'apprentissage de PySide, le binding Qt de Nokia pour Python. Il part de la présentations des widgets de bases jusqu'à la conception d'un programme minimaliste. Bonne lecture à tous et n'hésitez pas à poster vos commentaires. Apprentissage de PySide, le binding Qt de Nokia pour Python et création d'une première application...

    Read the article

  • WPF - List View Row Index and Validation

    - by abhishek
    Hi, I have a ListView with TextBoxes in second column. I want to validate that my text box does not contain a number if the third column(data_type) is "Text". I am unable to do the validation. I tried a few approaches. In one approach I try to handle the MouseDown event and am trying to get the Row number so that I can get the data_type value of that row. I want to us this value in the Validate method. I have been struggling for a week now. Would appreciate if anybody could help. <ControlTemplate x:Key="validationTemplate"> <DockPanel> <TextBlock Foreground="Red" FontSize="20">!</TextBlock> <AdornedElementPlaceholder/> </DockPanel> </ControlTemplate> <Style x:Key="textBoxInError" TargetType="{x:Type TextBox}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> </Style> <DataTemplate x:Key="textTemplate"> <TextBox HorizontalAlignment= "Stretch" IsEnabled="{Binding XPath=./@isenabled}" Validation.ErrorTemplate="{StaticResource validationTemplate}" Style="{StaticResource textBoxInError}"> <TextBox.Text> <Binding XPath="./@value" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <local:TextBoxMinMaxValidation> <local:TextBoxMinMaxValidation.DataType> <local:DataTypeCheck Datatype="{Binding Source={StaticResource dataProvider}, XPath='/[@id=CustomerServiceQueueName]'}"/> </local:TextBoxMinMaxValidation.DataType> <local:TextBoxMinMaxValidation.ValidRange> <local:Int32RangeChecker Minimum="{Binding Source={StaticResource dataProvider}, XPath=./@min}" Maximum="{Binding Source={StaticResource dataProvider}, XPath=./@max}"/> </local:TextBoxMinMaxValidation.ValidRange> </local:TextBoxMinMaxValidation> </Binding.ValidationRules> </Binding > </TextBox.Text> </TextBox> </DataTemplate> <DataTemplate x:Key="dropDownTemplate"> <ComboBox Name="cmbBox" HorizontalAlignment="Stretch" SelectedIndex="{Binding XPath=./@value}" ItemsSource="{Binding XPath=.//OPTION/@value}" IsEnabled="{Binding XPath=./@isenabled}" /> </DataTemplate> <DataTemplate x:Key="booldropDownTemplate"> <ComboBox Name="cmbBox" HorizontalAlignment="Stretch" SelectedIndex="{Binding XPath=./@value, Converter={StaticResource boolconvert}}"> <ComboBoxItem>True</ComboBoxItem> <ComboBoxItem>False</ComboBoxItem> </ComboBox> </DataTemplate> <local:ControlTemplateSelector x:Key="myControlTemplateSelector"/> <Style x:Key="StretchedContainerStyle" TargetType="{x:Type ListViewItem}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="Template" Value="{DynamicResource ListBoxItemControlTemplate1}"/> </Style> <ControlTemplate x:Key="ListBoxItemControlTemplate1" TargetType="{x:Type ListBoxItem}"> <Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" Padding="{TemplateBinding Padding}" BorderThickness="0,0.5,0,0.5"> <GridViewRowPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Border> </ControlTemplate> <Style x:Key="CustomHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"> <Setter Property="Background" Value="LightGray" /> <Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="Padding" Value="2,0,2,0"/> </Style> </UserControl.Resources> <Grid x:Name="GridViewControl" Height="Auto"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="34"/> </Grid.RowDefinitions> <ListView x:Name="ListViewControl" Grid.Row="0" ItemContainerStyle="{DynamicResource StretchedContainerStyle}" ItemTemplateSelector="{DynamicResource myControlTemplateSelector}" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Source={StaticResource dataProvider}, XPath=//CONFIGURATION}"> <ListView.View > <GridView > <GridViewColumn Header="ID" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" DisplayMemberBinding="{Binding XPath=./@id}"/> <GridViewColumn Header="VALUE" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" CellTemplateSelector="{DynamicResource myControlTemplateSelector}" /> <GridViewColumn Header="DATATYPE" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" DisplayMemberBinding="{Binding XPath=./@data_type}"/> <GridViewColumn Header="DESCRIPTION" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" DisplayMemberBinding="{Binding XPath=./@description}" Width="{Binding ElementName=ListViewControl, Path=ActualWidth}"/> </GridView> </ListView.View> </ListView> <StackPanel Grid.Row="1"> <Button Grid.Row="1" HorizontalAlignment="Stretch" Height="34" HorizontalContentAlignment="Stretch" > <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Horizontal" FlowDirection="RightToLeft" Height="30"> <Button Grid.Row="1" Content ="Apply" Padding="0,0,0,0 " Margin="6,2,0,2" Name="btn_Apply" HorizontalAlignment="Right" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="132" IsTabStop="True" Click="btn_ApplyClick" Height="24" /> </StackPanel > </Button> </StackPanel > </Grid>

    Read the article

  • MVVM, ContextMenus and binding to ViewModel defined Command

    - by Simon Fox
    Hi I am having problems with the binding of a ContextMenu command to an ICommand property in my ViewModel. The binding seems to be attaching fine...i.e when I inspect the value of the ICommand property it is bound to an instance of RelayCommand. The CanExecute delegate does get invoked, however when I open the context menu and select an item the Execute delegate does not get invoked. Heres my View (which is defined as the DataTemplate to use for instances of the following ViewModel in a resource dictionary): <UserControl x:Class="SmartSystems.DragDropProto.ProductLinkView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Proto"> <UserControl.Resources> <local:CenteringConverter x:Key="centeringConvertor"> </local:CenteringConverter> </UserControl.Resources> <UserControl.ContextMenu> <ContextMenu> <MenuItem Command="{Binding ChangeColor}">Change Color</MenuItem> </ContextMenu> </UserControl.ContextMenu> <Canvas> <Ellipse Width="5" Height="5" > <Ellipse.Fill> <SolidColorBrush Color="{Binding LinkColor}"></SolidColorBrush> </Ellipse.Fill> <Ellipse.RenderTransform> <TranslateTransform X="{Binding EndpointOneXPos, Converter={StaticResource centeringConvertor}}" Y="{Binding EndpointOneYPos, Converter={StaticResource centeringConvertor}}"/> </Ellipse.RenderTransform> </Ellipse> <Line X1="{Binding Path=EndpointOneXPos}" Y1="{Binding Path=EndpointOneYPos}" X2="{Binding Path=EndpointTwoXPos}" Y2="{Binding Path=EndpointTwoYPos}"> <Line.Stroke> <SolidColorBrush Color="{Binding LinkColor}"></SolidColorBrush> </Line.Stroke> </Line> <Ellipse Width="5" Height="5" > <Ellipse.Fill> <SolidColorBrush Color="{Binding LinkColor}"></SolidColorBrush> </Ellipse.Fill> <Ellipse.RenderTransform> <TranslateTransform X="{Binding EndpointTwoXPos, Converter={StaticResource centeringConvertor}}" Y="{Binding EndpointTwoYPos, Converter={StaticResource centeringConvertor}}"/> </Ellipse.RenderTransform> </Ellipse> </Canvas> </UserControl> and ViewModel (with uneccessary implementation details removed): class ProductLinkViewModel : BaseViewModel { public ICommand ChangeColor { get; private set; } public Color LinkColor { get; private set; } public ProductLinkViewModel(....) { ... ChangeColor = new RelayCommand(ChangeColorAction); LinkColor = Colors.Blue; } private void ChangeColorAction(object param) { LinkColor = LinkColor == Colors.Blue ? Colors.Red : Colors.Blue; OnPropertyChanged("LinkColor"); } }

    Read the article

  • Save password in WCF adapter binding file

    - by Edmund Zhao
    Binding file for WCF Adapter doesn't save the password no matter it is generated by "Add Generated Items..." wizard in Visual Studio or "Export Bindings..." in administration console. It is by design dut to the consideration of security, but it is very annoying especially when you import bindings which contain multiple WCF send ports. The way to aviod retyping password everytime after an import is to edit the binding file before import. Here is what needs to be done. 1. Find the following string:     &lt;Password vt="1" /&gt; "&lt;" means "<", "&gt;" means ">", "vt" means "Variable Type", variable type 1 is "NULL", so the above string can be translated to "<Password/>" 2. Replace it with:     &lt;Password vt="8"&gt;MyPassword&lt;/Password&gt;    variable type 8 is "string", the above string can be transalted to "<Password>MyPassword</Password>"   Binding file uses a lot of character entity references for XML character encoding purpose. For a list of the special charactor entiy references, you can check from here. ...Edmund Zhao

    Read the article

  • Treeview - Hierarchical Data Template - Binding does not update on source change?

    - by ClearsTheScreen
    Greetings! I ran into this problem in my project (Silverlight 3 with C#): I have a TreeView which is data bound to, well, a tree. This TreeView has a HierarchicalDataTamplate in a resource dictionary, that defines various controls. Now I want to hide (Visibility.Collapse) some items depending on wether a node has children or not. Other items shall be visible under the same condition. It works like charm when I first bind the source tree to the TreeView, but when I change the source tree, the visibility in the treeview does not change. XAML - page: <controls:TreeView x:Name="SankeyTreeView" ItemContainerStyle="{StaticResource expandedTreeViewItemStyle}" ItemTemplate="{StaticResource SankeyTreeTemplate}"> <controls:TreeViewItem IsExpanded="True"> <controls:TreeViewItem.HeaderTemplate> <DataTemplate> <TextBlock Text="This is just for loading and will be replaced directly after the data becomes available..."/> </DataTemplate> </controls:TreeViewItem.HeaderTemplate> </controls:TreeViewItem> </controls:TreeView> XAML - ResourceDictionary <!-- Each node in the tree is structurally identical, hence only one Hierarchical Data Template that'll use itself on the children. --> <Data:HierarchicalDataTemplate x:Key="SankeyTreeTemplate" ItemsSource="{Binding Children}"> <Grid Height="24"> <TextBlock x:Name="TextBlockName" Text="{Binding Path=Value.name, Mode=TwoWay}" VerticalAlignment="Center" Foreground="Black"/> <TextBox x:Name="TextBoxFlow" Text="{Binding Path=Value.flow, Mode=TwoWay}" Grid.Column="1" Visibility="{Binding Children, Converter={StaticResource BoxConverter}, ConverterParameter=\{box\}}"/> <TextBlock x:Name="TextBlockThroughput" Text="{Binding Path=Value.throughput, Mode=TwoWay}" Grid.Column="1" Visibility="{Binding Children, Converter={StaticResource BoxConverter}, ConverterParameter=\{block\}}"/> <Button x:Name="ButtonAddNode"/> <Button x:Name="ButtonDeleteNode"/> <Button x:Name="ButtonEditNode"/> </Grid> </Data:HierarchicalDataTemplate> Now, as you can see, the TextBoxFlow and the TextBlockThroughput share the same space. What I aim at: The "Throughput" value of a node is how much of something 'flows' through this node from its children. It can't be changed directly, so I want to display a text block. Only leaf nodes have a TextBox to let someone enter the 'flow' that is generated in this leaf node. (I.E.: Node.Throughput = Node.Flow + Sum(Children.Throughput), where Node.Flow = 0 for each non-leaf.) What the BoxConverter (silly name -.-) does: public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((value as NodeList<TreeItem>).Count > 1) // Node has Children? { if ((parameter as String) == "{box}") { return Visibility.Collapsed; } else ((parameter as String) == "{block}") { return Visibility.Visible; } } else { /* * As above, just with Collapsed and Visible switched */ } } The structure of the tree that is bound to the TreeView is essentially stolen from Dan Vanderboom (a bit too much to dump the whole code here), except that I here of course use an ObservableCollection for the children and the value items implement INotifyPropertyChanged. I would be very grateful if someone could explain to me, why inserting items into the underlying tree does not update the visibility for box and block. Thank you in advance!

    Read the article

  • Binding a select in a client template

    - by Bertrand Le Roy
    I recently got a question on one of my client template posts asking me how to bind a select tag’s value to data in client templates. I was surprised not to find anything on the web addressing the problem, so I thought I’d write a short post about it. It really is very simple once you know where to look. You just need to bind the value property of the select tag, like this: <select sys:value="{binding color}"> If you do it from markup like here, you just need to use the sys: prefix. It just works. Here’s the full source code for my sample page: <!DOCTYPE html> <html> <head> <title>Binding a select tag</title> <script src=http://ajax.microsoft.com/ajax/beta/0911/Start.js type="text/javascript"></script> <script type="text/javascript"> Sys.require(Sys.scripts.Templates, function() { var colors = [ "red", "green", "blue", "cyan", "purple", "yellow" ]; var things = [ { what: "object", color: "blue" }, { what: "entity", color: "purple" }, { what: "thing", color: "green" } ]; Sys.create.dataView("#thingList", { data: things, itemRendered: function(view, ctx) { Sys.create.dataView( Sys.get("#colorSelect", ctx), { data: colors }); } }); }); </script> <style type="text/css"> .sys-template {display: none;} </style> </head> <body xmlns:sys="javascript:Sys"> <div> <ul id="thingList" class="sys-template"> <li> <span sys:id="thingName" sys:style-color="{binding color}" >{{what}}</span> <select sys:id="colorSelect" sys:value="{binding color}" class="sys-template"> <option sys:value="{{$dataItem}}" sys:style-background-color="{{$dataItem}}" >{{$dataItem}}</option> </select> </li> </ul> </div> </body> </html> This produces the following page: Each of the items sees its color change as you select a different color in the drop-down. Other details worth noting in this page are the use of the script loader to get the framework from the CDN, and the sys:style-background-color syntax to bind the background color style property from markup. Of course, I’ve used a fair amount of custom ASP.NET Ajax markup in here, but everything could be done imperatively and with completely clean markup from the itemRendered event using Sys.bind.

    Read the article

  • How do I debug why an OSX key binding stopped working?

    - by nall
    Recently, I've realized that my ^A key binding has stopped working in OSX. My assumption is that some application has registered ^A as a hotkey, but I don't know that for certain. I don't recall installing anything new lately, but it's certainly possible that I did and just forgot. Some other pertinent info: ^A doesn't work in any application -- this isn't just a Terminal.app issue Other control combos (eg: ^E) still work as expected Looking through the Keyboard System Preferences pane shows nothing bound to ^A A reboot doesn't help However, logging into under a freshly made account does cause the issue to go away (i.e.: ^A works for the test account) My StandardKeyBinding.dict has the correct value for ^A Note: I don't have a DefaultKeyBinding.dict in /Library/KeyBindings or ~/Library/KeyBindings Any ideas on how to debug this?

    Read the article

  • treeview binding wpf cannot bind nested property in a class

    - by devnet247
    Hi all New to wpf and therefore struggling a bit. I am putting together a quick demo before we go for the full implementation I have a treeview on the left with Continent Country City structure when a user select the city it should populate some textboxes in a tabcontrol on the right hand side I made it sort of work but cannot make it work with composite objects. In a nutshell can you spot what is wrong with my zaml or code. Why is not binding to a my CityDetails.ClubsCount or CityDetails.PubsCount? What I am building is based on http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx Thanks a lot for any suggestions or reply DataModel public class City { public City(string cityName) { CityName = cityName; } public string CityName { get; set; } public string Population { get; set; } public string Area { get; set; } public CityDetails CityDetailsInfo { get; set; } } public class CityDetails { public CityDetails(int pubsCount,int clubsCount) { PubsCount = pubsCount; ClubsCount = clubsCount; } public int ClubsCount { get; set; } public int PubsCount { get; set; } } ViewModel public class CityViewModel : TreeViewItemViewModel { private City _city; private RelayCommand _testCommand; public CityViewModel(City city, CountryViewModel countryViewModel):base(countryViewModel,false) { _city = city; } public string CityName { get { return _city.CityName; } } public string Area { get { return _city.Area; } } public string Population { get { return _city.Population; } } public City City { get { return _city; } set { _city = value; } } public CityDetails CityDetailsInfo { get { return _city.CityDetailsInfo; } set { _city.CityDetailsInfo = value; } } } XAML <DockPanel> <DockPanel LastChildFill="True"> <Label DockPanel.Dock="top" Content="Title " HorizontalAlignment="Center"></Label> <StatusBar DockPanel.Dock="Bottom"> <StatusBarItem Content="Status Bar" ></StatusBarItem> </StatusBar> <Grid DockPanel.Dock="Top"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="2*"/> </Grid.ColumnDefinitions> <TreeView Name="tree" ItemsSource="{Binding Continents}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"/> <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"/> <Setter Property="FontWeight" Value="Normal"/> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="FontWeight" Value="Bold"></Setter> </Trigger> </Style.Triggers> </Style> </TreeView.ItemContainerStyle> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type ViewModels:ContinentViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Continent.png"/> <TextBlock Text="{Binding ContinentName}"/> </StackPanel> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type ViewModels:CountryViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Country.png"/> <TextBlock Text="{Binding CountryName}"/> </StackPanel> </HierarchicalDataTemplate> <DataTemplate DataType="{x:Type ViewModels:CityViewModel}" > <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\City.png"/> <TextBlock Text="{Binding CityName}"/> </StackPanel> </DataTemplate> </TreeView.Resources> </TreeView> <GridSplitter Grid.Row="0" Grid.Column="1" Background="LightGray" Width="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> <Grid Grid.Column="2" Margin="5" > <TabControl> <TabItem Header="Details" DataContext="{Binding Path=SelectedItem.City, ElementName=tree, Mode=OneWay}"> <StackPanel > <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityName}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Area}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Population}"/> <!-- DONT WORK WHY--> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.ClubsCount}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.PubsCount}"/> </StackPanel> </TabItem> </TabControl> </Grid> </Grid> </DockPanel> </DockPanel>

    Read the article

  • WPF binding to ComboBox SelectedItem when reference not in ItemsSource.

    - by juharr
    I'm binding the PageMediaSize collection of a PrintQueue to the ItemSource of a ComboBox (This works fine). Then I'm binding the SelectedItem of the ComboBox to the DefaultPrintTicket.PageMediaSize of the PrintQueue. While this will set the selected value to the DefaultPrintTicket.PageMediaSize just fine it does not set the initially selected value of the ComboBox to the initial value of DefaultPrintTicket.PageMediaSize This is because the DefaultPrintTicket.PageMediaSize reference does not match any of the references in the collection. However I don't want it to compare the objects by reference, but instead by value, but PageMediaSize does not override Equals (and I have no control over it). What I'd really like to do is setup a IComparable for the ComboBox to use, but I don't see any way to do that. I've tried to use a Converter, but I would need more than the value and I couldn't figured out how to pass the collection to the ConverterProperty. Any ideas on how to handle this problem. Here's my xaml <ComboBox x:Name="PaperSizeComboBox" ItemsSource="{Binding ElementName=PrintersComboBox, Path=SelectedItem, Converter={StaticResource printQueueToPageSizesConverter}}" SelectedItem="{Binding ElementName=PrintersComboBox, Path=SelectedItem.DefaultPrintTicket.PageMediaSize}" DisplayMemberPath="PageMediaSizeName" Height="22" Margin="120,76,15,0" VerticalAlignment="Top"/> And the code for the converter that gets the PageMediaSize collection public class PrintQueueToPageSizesConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value == null ? null : ((PrintQueue)value).GetPrintCapabilities().PageMediaSizeCapability; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }

    Read the article

  • WPF Datagrid items binding problem

    - by gencay
    I get a problem while displaying a List in WPF-Datagrid. When I do this line ... DocumentList dt = new DocumentList(fileWordList, fileUriType, fileUri, cosineSimilarityRatio, diceSimilarityRatio, extendedJaccardSimilarityRatio); documentList.Add(dt); ... dataGrid1.Items.Add(dt); ... It creates an empty row into dataGrid1 and no text is shown there. my xaml implementation is this: <GroupBox Canvas.Left="-0.003" Canvas.Top="0" Header="Display Results" Height="427.5" Name="groupBox2" Width="645.56"> <toolkit:DataGrid Canvas.Left="137.5" Canvas.Top="240" Height="392" Name="dgrDocumentList" Width="627" ItemsSource="{Binding DocumentList }"> <toolkit:DataGrid.Columns> <toolkit:DataGridTextColumn Header="Type" Binding="{Binding type}" IsReadOnly="True"> </toolkit:DataGridTextColumn> <toolkit:DataGridHyperlinkColumn Header="Uri" Binding="{Binding path}" IsReadOnly="True"> </toolkit:DataGridHyperlinkColumn> <toolkit:DataGridTextColumn Header="Cosine" Binding="{Binding cos}" IsReadOnly="True"> </toolkit:DataGridTextColumn> <toolkit:DataGridTextColumn Header="Dice" Binding="{Binding dice}" IsReadOnly="True"> </toolkit:DataGridTextColumn> <toolkit:DataGridTextColumn Header="Jaccard" Binding="{Binding jaccard}" IsReadOnly="True"> </toolkit:DataGridTextColumn> </toolkit:DataGrid.Columns> </toolkit:DataGrid> </GroupBox> and my DocumentList class class DocumentList { public List<WordList> wordList; public string type; public string path; public double cos; public double dice; public double jaccard; //public static string title; public DocumentList(List<WordList> wordListt, string typee, string pathh, double sm11, double sm22, double sm33) { type = typee; wordList = wordListt; path = pathh; cos = sm11; dice = sm22; jaccard = sm33; } I would like to do that: When i add a new element into documentList instance, would like to see the results on data grid. Thank you in advance.

    Read the article

  • Interpreted vs. Compiled vs. Late-Binding

    - by zubin71
    Python is compiled into an intermediate bytecode(pyc) and then executed. So, there is a compilation followed by interpretation. However, long-time Python users say that Python is a "late-binding" language and that it should`nt be referred to as an interpreted language. How would Python be different from another interpreted language? Could you tell me what "late-binding" means, in the Python context? Java is another language which first has source code compiled into bytecode and then interpreted into bytecode. Is Java an interpreted/compiled language? How is it different from Python in terms of compilation/execution? Java is said to not have, "late-binding". Does this have anything to do with Java programs being slighly faster than Python? Itd be great if you could also give me links to places where people have already discussed this; id love to read more on this. Thank you.

    Read the article

  • Why does this binding doesn't work through XAML but does by code ?

    - by user361899
    I am trying to bind to a static property on a static class, this property contains settings that are deserialized from a file. It never works with the following XAML : <Window.Resources> <ObjectDataProvider x:Key="wrapper" ObjectType="{x:Type Application:Wrapper}"/> </Window.Resources> <ScrollViewer x:Name="scrollViewer" ScrollViewer.VerticalScrollBarVisibility="Auto"DataContext="{Binding Source={StaticResource wrapper}, UpdateSourceTrigger=PropertyChanged}"> <ComboBox x:Name="comboboxThemes" SelectedIndex="0" SelectionChanged="ComboBoxThemesSelectionChanged" Grid.Column="1" Grid.Row="8" Margin="4,3" ItemsSource="{Binding Settings.Themes, Mode=OneWay}" SelectedValue="{Binding Settings.LastTheme, Mode=TwoWay}" /> It does work by code however : comboboxThemes.ItemsSource = Settings.Themes; Any idea ? Thank you :-)

    Read the article

  • [Windows 8] Update TextBox’s binding on TextChanged

    - by Benjamin Roux
    Since UpdateSourceTrigger is not available in WinRT we cannot update the text’s binding of a TextBox at will (or at least not easily) especially when using MVVM (I surely don’t want to write behind-code to do that in each of my apps !). Since this kind of demand is frequent (for example to disable of button if the TextBox is empty) I decided to create some attached properties to to simulate this missing behavior. namespace Indeed.Controls { public static class TextBoxEx { public static string GetRealTimeText(TextBox obj) { return (string)obj.GetValue(RealTimeTextProperty); } public static void SetRealTimeText(TextBox obj, string value) { obj.SetValue(RealTimeTextProperty, value); } public static readonly DependencyProperty RealTimeTextProperty = DependencyProperty.RegisterAttached("RealTimeText", typeof(string), typeof(TextBoxEx), null); public static bool GetIsAutoUpdate(TextBox obj) { return (bool)obj.GetValue(IsAutoUpdateProperty); } public static void SetIsAutoUpdate(TextBox obj, bool value) { obj.SetValue(IsAutoUpdateProperty, value); } public static readonly DependencyProperty IsAutoUpdateProperty = DependencyProperty.RegisterAttached("IsAutoUpdate", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(false, OnIsAutoUpdateChanged)); private static void OnIsAutoUpdateChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { var value = (bool)e.NewValue; var textbox = (TextBox)sender; if (value) { Observable.FromEventPattern<TextChangedEventHandler, TextChangedEventArgs>( o => textbox.TextChanged += o, o => textbox.TextChanged -= o) .Do(_ => textbox.SetValue(TextBoxEx.RealTimeTextProperty, textbox.Text)) .Subscribe(); } } } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The code is composed of two attached properties. The first one “RealTimeText” reflects the text in real time (updated after each TextChanged event). The second one is only used to enable the functionality. To subscribe to the TextChanged event I used Reactive Extensions (Rx-Metro package in Nuget). If you’re not familiar with this framework just replace the code with a simple: textbox.TextChanged += textbox.SetValue(TextBoxEx.RealTimeTextProperty, textbox.Text); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } To use these attached properties, it’s fairly simple <TextBox Text="{Binding Path=MyProperty, Mode=TwoWay}" ic:TextBoxEx.IsAutoUpdate="True" ic:TextBoxEx.RealTimeText="{Binding Path=MyProperty, Mode=TwoWay}" /> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Just make sure to create a binding (in TwoWay) for both Text and RealTimeText. Hope this helps !

    Read the article

  • MVC data binding

    - by user441521
    I'm using MVC but I've read that MVVM is sort of about data binding and having pure markup in your views that data bind back to the backend via the data-* attributes. I've looked at knockout but it looks pretty low level and I feel like I can make a library that does this and is much easier to use where basically you only need to call 1 javascript function that will data bind your entire page because of the data-* attributes you assign to html elements. The benefits of this (that I see) is that your view is 100% decoupled from your back-end so that a given view never has to be changed if your back-end changes (ie for asp.net people no more razor in your view that makes your view specific to MS). My question would be, I know there is knockout out there but are there any others that provide this data binding functionality for MVC type applications? I don't want to recreate something that may already exist but I want to make something "better" and easier to use than knockout. To give an example of what I mean here is all the code one would need to get data binding in my library. This isn't final but just showing the idea that all you have to do is call 1 javascript function and set some data-* attribute values and everything ties together. Is this worth seeing through? <script> $(function () { // this is all you have to call to make databinding for POST or GET to work DataBind(); }); </script> <form id="addCustomer" data-bind="Customer" data-controller="Home" data-action="CreateCustomer"> Name: <input type="text" data-bind="Name" data-bind-type="text" /> Birthday: <input type="text" data-bind="Birthday" data-bind-type="text" /> Address: <input type="text" data-bind="Address" data-bind-type="text" /> <input type="submit" value="Save" id="btnSave" /> </form> ================================================= // controller action [HttpPost] public string CreateCustomer(Customer customer) { if(customer.Name == "Rick") return "success"; return "failure"; } // model public class Customer { public string Name { get; set; } public DateTime Birthday { get; set; } public string Address { get; set; } }

    Read the article

  • How do I resolve the error "Binding already being used by a product other than IIS"

    - by magnifico
    I have an SSL cert with its own unique IP address on a 2008 R2 server. I have created a basic website using IIS Manager, with a file called “Hello.html” in the root. When trying to add an https binding I receive the following error after choosing my certificate: This binding is already being used by a product other than IIS. If you continue you might overwrite the existing certificate for this IP Address:Port combnation. Do you want to use this binding anyway?" I click Yes to this prompt and the binding is created. When I try to retrieve my file using the server’s own browser, the request times out. I have another server which has a shared configuration with this one, and it works fine. Does anyone have any suggestions how to find out which application may be using this binding other than IIS, and how to resolve?

    Read the article

  • WPF Update Binding when Bound directly to DataContext w/ Converter

    - by Adam
    Normally when you want a databound control to 'update,' you use the "PropertyChanged" event to signal to the interface that the data has changed behind the scenes. For instance, you could have a textblock that is bound to the datacontext with a property "DisplayText" <TextBlock Text="{Binding Path=DisplayText}"/> From here, if the DataContext raises the PropertyChanged event with PropertyName "DisplayText," then this textblock's text should update (assuming you didn't change the Mode of the binding). However, I have a more complicated binding that uses many properties off of the datacontext to determine the final look and feel of the control. To accomplish this, I bind directly to the datacontext and use a converter. In this case I am working with an image source. <Image Source="{Binding Converter={StaticResource ImageConverter}}"/> As you can see, I use a {Binding} with no path to bind directly to the datacontext, and I use an ImageConverter to select the image I'm looking for. But now I have no way (that I know of) to tell that binding to update. I tried raising the propertychanged event with "." as the propertyname, which did not work. Is this possible? Do I have to wrap up the converting logic into a property that the binding can attach to, or is there a way to tell the binding to refresh (without explicitly refreshing the binding)? Any help would be greatly appreciated. Thanks! -Adam

    Read the article

  • WPF trigger on datagrid to hide/show columns according to bindings

    - by Renan
    I have a data grid like this: <DataGrid AutoGenerateColumns="False" CanUserDeleteRows="True" HorizontalScrollBarVisibility="Hidden" Margin="10,10,10,10" VerticalScrollBarVisibility="Visible" CanUserAddRows="False" ItemsSource="{Binding ListGestores}" ToolTip="Selecione uma linha e pressione DELETE para remover uma unidade."> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding TB_UNIDADE.DS_NOME_UNIDADE}" CanUserResize="False" Header="Setor" IsReadOnly="True" x:Name=""/> <DataGridTextColumn Binding="{Binding TB_UNIDADE.TB_UNIDADE2.DS_NOME_UNIDADE}" CanUserResize="False" Header="Unidade" IsReadOnly="True" x:Name=""/> <DataGridTextColumn Binding="{Binding TB_CONTATOS.DS_NOME}" CanUserResize="False" Header="Gestor" IsReadOnly="True" /> </DataGrid.Columns> </DataGrid> The problem is that i need to verify if the 2 column binding is null, and if it is null, i need to Hide it, and Change the Header of the column 1. I know that i can do that with Triggers, but how exactly??? I started with: <DataGrid.Triggers> <DataTrigger Binding="{Binding TB_UNIDADE.TB_UNIDADE2}" Value="{x:Null}"> <Setter Property="" Value="" /> </DataTrigger> </DataGrid.Triggers> But i don't know what setter or whatever to put ! Help me =]

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >