Search Results

Search found 103 results on 5 pages for 'isreadonly'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • WPF binding to a boolean on a control

    - by Jose
    I'm wondering if someone has a simple succinct solution to binding to a dependency property that needs to be the converse of the property. Here's an example I have a textbox that is disabled based on a property in the datacontext e.g.: <TextBox IsEnabled={Binding CanEdit} Text={Binding MyText}/> The requirement changes and I want to make it ReadOnly instead of disabled, so without changing my ViewModel I could do this: In the UserControl resources: <UserControl.Resources> <m:NotConverter x:Key="NotConverter"/> </UserControl.Resources> And then change the TextBox to: <TextBox IsReadOnly={Binding CanEdit,Converter={StaticResource NotConverter}} Text={Binding MyText}/> Which I personally think is EXTREMELY verbose I would love to be able to just do this(notice the !): <TextBox IsReadOnly={Binding !CanEdit} Text={Binding MyText}/> But alas, that is not an option that I know of. I can think of two options. Create an attached property IsNotReadOnly to FrameworkElement(?) and bind to that property If I change my ViewModel then I could add a property CanEdit and another CannotEdit which I would be kind of embarrassed of because I believe it adds an irrelevant property to a class, which I don't think is a good practice. The main reason for the question is that in my project the above isn't just for one control, so trying to keep my project as DRY as possible and readable I am throwing this out to anyone feeling my pain and has come up with a solution :)

    Read the article

  • WPF Combobox: Autocomplete

    - by user279244
    Hi, I have implemented a Autocomplete enabled Combobox in WPF. It is like below... private void cbxSession_Loaded(object sender, RoutedEventArgs e) { cbxSession.ApplyTemplate(); TextBox textBox = cbxSession.Template.FindName("PART_EditableTextBox", cbxSession) as TextBox; textBox.IsReadOnly = false; if (textBox != null) { textBox.KeyUp += new KeyEventHandler(textBox_KeyUp); textBox.KeyUp += delegate { ///open the drop down and start filtering based on what the user types into the combobox cbxSession.IsDropDownOpen = true; cbxSession.Items.Filter += a => { if (a.ToString().ToUpper().Contains(textBox.Text.ToUpper())) return true; else return false; }; }; } } void textBox_KeyUp(object sender, KeyEventArgs e) { if ((e.Key == System.Windows.Input.Key.Up) || (e.Key == System.Windows.Input.Key.Down)) { e.Handled = true; } else if (e.Key == System.Windows.Input.Key.Enter) { e.Handled = true; cbxSession.IsDropDownOpen = false; } } void textBox_KeyDown(object sender, KeyEventArgs e) { cbxSession.SelectionChanged -= cbxSession_SelectionChanged; if (e.Key == System.Windows.Input.Key.Enter) { e.Handled = true; cbxSession.SelectionChanged += cbxSession_SelectionChanged; } if ((e.Key == System.Windows.Input.Key.Up) || (e.Key == System.Windows.Input.Key.Down)) { e.Handled = true; } } private void cbxSession_DropDownClosed(object sender, EventArgs e) { if (cbxSession.Text != "") { TextBox textBox = cbxSession.Template.FindName("PART_EditableTextBox", cbxSession) as TextBox; if (!cbxSession.Items.Contains(textBox.Text)) { textBox.Text = cbxSession.Text; } } } private void cbxSession_DropDownOpened(object sender, EventArgs e) { cbxSession.Items.Filter += a => { return true; }; } <ComboBox x:Name="cbxSession" Width="260" Canvas.Top="5" Canvas.Left="79" Height="25" Visibility="Visible" SelectionChanged="cbxSession_SelectionChanged" MaxDropDownHeight="200" IsTextSearchEnabled="False" IsEditable="True" IsReadOnly="True" Loaded="cbxSession_Loaded" DropDownClosed="cbxSession_DropDownClosed" StaysOpenOnEdit="True" DropDownOpened="cbxSession_DropDownOpened"> <ComboBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel IsVirtualizing="True" IsItemsHost="True"/> </ItemsPanelTemplate> </ComboBox.ItemsPanel> </ComboBox> But, the problem I am facing is... When I try searching, the first character goes missing. And this happens only once. Secondly, When I am using Arrow buttons to the filtered items, the ComboboxSelectionChanged event is fired. Is there any way to make it fire only on the click of 'Enter'

    Read the article

  • WPF Open Combobox popup on Focus or GotFocus

    - by ashish.magroria
    Hi, I am trying to open the combobox popup when it is focused using Style/Event Trigger I used the following code in my Combobox control Template: <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> <Grid > <ToggleButton Grid.Column="2" Template="{DynamicResource ComboBoxToggleButton}" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/> <ContentPresenter HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="ContentSite" VerticalAlignment="Center" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" IsHitTestVisible="False"/> <TextBox Visibility="Hidden" Template="{DynamicResource ComboBoxTextBox}" HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="PART_EditableTextBox" Style="{x:Null}" VerticalAlignment="Center" Focusable="True" Background="Transparent" IsReadOnly="{TemplateBinding IsReadOnly}"/> <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide"> <Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True"> <Border x:Name="DropDownBorder" Background="{DynamicResource ShadeBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/> <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True"> <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained"/> </ScrollViewer> </Grid> </Popup> </Grid> <ControlTemplate.Triggers> **<Trigger Property="IsMouseOver" Value="True"> <Setter Property="IsOpen" Value="True" TargetName="Popup"/> </Trigger>** </ControlTemplate.Triggers> </ControlTemplate> But nothing happens with this code. So I trid the following Event trigger in ControlTemplate.Triggers <EventTrigger RoutedEvent="UIElement.GotFocus"> <BeginStoryboard> <Storyboard > <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Popup" Storyboard.TargetProperty="IsOpen" FillBehavior="HoldEnd"> <DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="True" /> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="UIElement.LostFocus"> <BeginStoryboard> <Storyboard > <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Popup" Storyboard.TargetProperty="IsOpen" FillBehavior="HoldEnd"> <DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="False" /> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> Now this helps open the popup on focus, but when I select any item from dropdown the pop up doesnt disappear as usual; it stays open. it closes only after I click somewhere else in the window. Can someone please suggest the proper way to do this Thanks in advance

    Read the article

  • Disable Drag-drop from TextBox

    - by viky
    I have a WPF textBox that is declared as ReadOnly <TextBox IsReadOnly="True" IsTabStop="False" Width="200" /> So, User can not write anything into the TextBox or delete the content but it still allows user to drag the text from this textbox and drop it in any other textbox that caused the text removed from the first textbox(the read-only one) and thats unexpected. Is it a bug? how can I get rid of this?

    Read the article

  • Retrive JSON data from JSON Object in C#

    - by user1638260
    JsonObject friendlist = facebookClient.Get("/me/friends") as JsonObject; //Retrive Data from friendlist { "data": [ { "name": "Mehta", "id": "1000032633029611" }, { "name": "Patu Mehta", "id": "1000042433527270" } ], "paging": { "next": "https://graph.facebook.com/100004241944047/friends?access_token=AAAEXJfmh18QBALKtilFYJz5PU6XvxKIaZAc65NYtyZCLbOqFKyZC8hdyjaU7C7w1CaLKG8tFdRtLYqtAX3vqrPwYNNe5G0aTGhB5x1mwgZDZD&limit=5000&offset=5000&__after_id=100004244527270" } } Count: 2 IsReadOnly: false Keys: Count = 2 Values: Count = 2 But i required only data not whole value like

    Read the article

  • Why does VerticalScrollBarVisibility not work in a style in Silverlight?

    - by Edward Tanguay
    VerticalScrollBarVisibility works when I define it inline like this: <UserControl x:Class="TestScrollBar.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <UserControl.Resources> <Style TargetType="TextBox" x:Key="EditListContainerContentMultiLineTwoColumn"> <Setter Property="AcceptsReturn" Value="True"/> <Setter Property="Width" Value="400"/> <Setter Property="Height" Value="300"/> <Setter Property="IsReadOnly" Value="False"/> <Setter Property="Margin" Value="0 0 0 20"/> <Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" Margin="10"> <StackPanel HorizontalAlignment="Left"> <TextBox Text="this is a test" Style="{StaticResource EditListContainerContentMultiLineTwoColumn}" VerticalScrollBarVisibility="Auto" /> </StackPanel> </Grid> </UserControl> But when I put VerticalScrollBarVisibility in a style, it shows me a blank screen: <UserControl x:Class="TestScrollBar.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <UserControl.Resources> <Style TargetType="TextBox" x:Key="EditListContainerContentMultiLineTwoColumn"> <Setter Property="VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="AcceptsReturn" Value="True"/> <Setter Property="Width" Value="400"/> <Setter Property="Height" Value="300"/> <Setter Property="IsReadOnly" Value="False"/> <Setter Property="Margin" Value="0 0 0 20"/> <Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" Margin="10"> <StackPanel HorizontalAlignment="Left"> <TextBox Text="this is a test" Style="{StaticResource EditListContainerContentMultiLineTwoColumn}" /> </StackPanel> </Grid> </UserControl> In WPF it works works fine. How can I get VerticalScrollBarVisibility to work in a style?

    Read the article

  • WPF format displayed text?

    - by Mark
    I have a column defined like this: <DataGridTextColumn Binding="{Binding Path=FileSizeBytes, Mode=OneWay}" Header="Size" IsReadOnly="True" /> But instead of displaying the file size as a big number, I'd like to display units, but still have it sort by the actual FileSizeBytes. Is there some way I can run it through a function or something before displaying it?

    Read the article

  • events not getting fired properly

    - by prince23
    hi, this is my xaml code. datagrid within another data grid. <sdk:DataGrid x:Name="dgLevel1" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="12,12,0,0" RowDetailsVisibilityChanged="dgLevel1_RowDetailsVisibilityChanged" SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected" Height="412" HorizontalAlignment="Left" Width="816"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Width="24" Height="24" Click="ExpandLevel1_Click"> <Image x:Name="imgLevel1" Source="Images/detail.JPG" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn Header="Actual" Visibility="Collapsed"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding UniqueName}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="550" /> <!--<sdk:DataGridTextColumn Binding="{Binding UniqueName}" Visibility="Collapsed"/>--> <sdk:DataGridTemplateColumn Header="Actual" Width="80" > <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding Age}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <StackPanel Width="805"> <sdk:DataGrid x:Name="dgLevel2" Width="797" Margin="17,0,0,0" HeadersVisibility ="None" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" RowDetailsVisibilityChanged="dgLevel2_RowDetailsVisibilityChanged" SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Width="24" Height="30" Click="ExpandLevel2_Click"> <Image x:Name="imgLevel2" Source="Images/detail.JPG" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Binding="{Binding School}" Width="528" /> <sdk:DataGridTextColumn Binding="{Binding College}" Visibility="Collapsed" /> <sdk:DataGridTemplateColumn Header="Actual" Width="80"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding DOB}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> </StackPanel> </DataTemplate> </sdk:DataGrid.RowDetailsTemplate> </sdk:DataGrid> i have 2 data grid and have 2 image buttons in both the grid . but the event which is in datagrid ExpandLevel1 _Click and ExpandLevel2 _Click is not getting fired properly. some times get fired some times no when i click the button first this event gets fired then ExpandLevel1_Click then **dgLevel1_RowDetailsVisibilityChanged . same thing is happening for the datagrid 2 ExpandLevel2_Click then dgLevel2_RowDetailsVisibilityChanged** there are scenario where first datagrid event gets fired first then button click events why is this happening .is there any solution for this looking forward an solutions thanks in advance. prince

    Read the article

  • expand/collpase datagrid

    - by prince23
    hi, i have an nested datagrid . i able to bind the values with no issues once i clik teh row i able to show nested grid. now i need to add an image button( like an "+ " Symbol ) at the left corner. once i press this button the grid shows the further records under it. that time i need to repalce the image button with ("--" symbol). i have these two images done. but how to do this is really a big issue now for me.can any one help me out.struck on this issue from past 3 days. plz plz provide an solution on this. i would be really thank full for you guys . am new to silver light this is my code. <sdk:DataGrid MinHeight="100" x:Name="dgCounty" AutoGenerateColumns="False" VerticalAlignment="Top" Grid.Row="1" IsReadOnly="True" Margin="5,5,5,0" RowDetailsVisibilityChanged="dgCounty_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn CanUserReorder="False"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="+" Click="Button_Click"></Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Header="ID" Width="100" Binding="{Binding EmployeeID}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="FirstName" Width="80" Binding="{Binding EmployeeFName}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="LastName" Width="80" Binding="{Binding EmployeeLName}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="MailID" Width="80" Binding="{Binding EmployeeMailID}" CanUserReorder="False"/> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <sdk:DataGrid x:Name="dgrdRowDetail" Width="400" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" > <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Header="CompanyName" Binding="{Binding CompanyName}"/> <sdk:DataGridTextColumn Header="CompanyID" Binding="{Binding CompanyID}"/> <sdk:DataGridTemplateColumn Header="Score"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <StackPanel Loaded ="StackPanel_Loaded" Orientation="Horizontal" Background="Transparent"> <TextBlock Text="{Binding Score}" TextWrapping="NoWrap" HorizontalAlignment="Center" Foreground="Blue"></TextBlock> <!--<Image Source ="../Images/image1.JPG" Width="20" Height="20" Stretch ="Fill"/>--> <Image x:Name="imgScore" Source ="{Binding Score}" Width="20" Height="20" Stretch ="Fill"/> <sdk:Label Content="Score" /> </StackPanel> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> private void Button_Click(object sender, RoutedEventArgs e) { //how to handle this issue. } if possiable plz provide the code that can help me out.

    Read the article

  • using one data template in another data template in WPF

    - by Sowmya
    Hi, I have two data templates, one of which is the subset of another like below: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igEditors="http://infragistics.com/Editors" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:controls="clr-namespace:Client.UI.WPF;assembly=Client.UI.WPF" xmlns:d="http://schemas.microsoft.com/expression/blend/2006" > <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/Client.Resources.WPF.Styles;Component/Styles/CommonStyles.xaml"/> </ResourceDictionary.MergedDictionaries> <DataTemplate x:Key="XYZDataTemplate"> <Grid x:Name="_rootGrid" DataContext="{Binding DataContext}" HorizontalAlignment="Left" VerticalAlignment="Top"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <controls:ValueDisplay Grid.Row="0" Grid.Column="0" LabelText="Build number" x:Name="buildNumber" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="5,10,0,0"> <igEditors:XamTextEditor /> </controls:ValueDisplay> <controls:ValueDisplay Grid.Row="0" Grid.Column="1" LabelText="Tool version" x:Name="toolVersion" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="20,10,0,0"> <igEditors:XamTextEditor IsReadOnly="True"/> </controls:ValueDisplay> </Grid> </DataTemplate> and the other is like below: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igEditors="http://infragistics.com/Editors" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:controls="clr-namespace:BHI.ULSS.Client.UI.WPF;assembly=ULSS.Client.UI.WPF" xmlns:d="http://schemas.microsoft.com/expression/blend/2006" > <DataTemplate x:Key="ABCDataTemplate" > <Grid x:Name="_rootGrid" DataContext="{Binding DataContext}" HorizontalAlignment="Left" VerticalAlignment="Top"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <controls:ValueDisplay Grid.Row="0" Grid.Column="0" LabelText="Build number" x:Name="buildNumber" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="5,10,0,0"> <igEditors:XamTextEditor /> </controls:ValueDisplay> <controls:ValueDisplay Grid.Row="0" Grid.Column="1" LabelText="Tool version" x:Name="toolVersion" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="20,10,0,0"> <igEditors:XamTextEditor IsReadOnly="True"/> </controls:ValueDisplay> <controls:ValueDisplay Grid.Row="0" Grid.Column="2" LabelText="Size" ShowUnit="True" x:Name="size" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="20,10,0,0"> <igEditors:XamTextEditor/> </controls:ValueDisplay> </Grid> </DataTemplate> XYZDataTemplate is a subset of the ABCDataTemplate as the first two fields in both the data templates are common, so I was wondering if it is possible to replace the redundant code in the ABCDataTemplate with that of the XYZDataTemplate for code maintainability? Could anyone please suggest if would this be a right approach, if so how can I acheive that? Thanks in advance, Sowmya

    Read the article

  • Blazing fast performance with RadGridView for Silverlight 4, RadDataPager and WCF RIA Services

    In my previous post I’ve used almost 2 million records to the check the grid performance in WPF and I’ve decided to do the same for Silverlight 4 using WCF RIA Services. The grid again is bound completely codelessly using DomainDataSource and RadDataPager: <Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <riaControls:DomainDataSource Name="orderDomainDataSource" QueryName="GetOrdersAndOrderDetails"> <riaControls:DomainDataSource.DomainContext> <my:NorthwindDomainContext /> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource> <telerik:RadGridView Name="RadGridView1" IsReadOnly="True" AutoExpandGroups="True" ItemsSource="{Binding Data, ElementName=orderDomainDataSource}" /> <telerik:RadDataPager Grid.Row="1" PageSize="10" Source="{Binding Data, ElementName=orderDomainDataSource}" DisplayMode="All" /> </Grid> And the query again will return join between Northwind Orders and Order_Details: … public IQueryable<OrdersAndOrderDetails> GetOrdersAndOrderDetails() ...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How To: Filter as you type RadGridView inside RadComboBox for WPF and Silverlight

    Ive made small example on how to place RadGridView inside editable RadComboBox and filter the grid items as you type in the combo:   The easiest way to place any UI element in RadComboBox is to create single RadComboBoxItem and define desired Template: <telerikInput:RadComboBox Text="{Binding Text, Mode=TwoWay}" IsEditable="True" Height="25" Width="200"> <telerikInput:RadComboBox.Items> <telerikInput:RadComboBoxItem> <telerikInput:RadComboBoxItem.Template> <ControlTemplate> <telerikGrid:RadGridView x:Name="RadGridView1" ShowGroupPanel="False" CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" IsReadOnly="True" IsFilteringAllowed="False" ItemsSource="{Binding Items}" Width="200" Height="150" SelectedItem="{Binding SelectedItem, Mode=TwoWay}"> </telerikGrid:RadGridView> </ControlTemplate> </telerikInput:RadComboBoxItem.Template> </telerikInput:RadComboBoxItem> </telerikInput:RadComboBox.Items> </telerikInput:RadComboBox> Now you can create small view model and bind ...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Entity is currently read-only

    - by George Evjen
    Quick post on an issue that we were having today. This fix may just be a band-aid for another issue but this fix at least got us moving again today. Since I didn’t see anything concrete online for a solution I figured I would post this as a part one fix and then post a more detailed fix later. We were getting this error earlier today in one of our projects that uses EF and WCF Ria Services. This entity is currently read-only. One of the following conditions exist: a custom method has been invoked, a submit operation is in progress, or edit operations are not supported for the entity type. The work around that we used for this is to simply do a check to see if the property is read only. Each entity has that property on it. private void SelectedInstitution_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)        {            if (!_personDetailContext.CurrentPerson.IsReadOnly)            {                _personDetailContext.CurrentPerson.LastUpdatedDate = DateTime.Now;            }        } We check to see if the CurrentPerson in this situation is readonly. If its not read only we go ahead and execute some other code. Again, this got us moving today, I am sure this is just step one in resolving this issue.

    Read the article

  • WPF DataGrid DataGridHyperlinkColumn bound to Uri

    - by MicMit
    No problem when binding to a property of string type ( "http://something.com" ). However , I seem to have seen in old examples direct binding to Uri property. <dg:DataGridHyperlinkColumn IsReadOnly="True" Header="Uri" Binding="{Binding Path=NavigURI}" /> NavigURI is Uri . More recent docs seem to require a converter <DataGridHyperlinkColumn Header="Email" Binding="{Binding Email}" ContentBinding="{Binding Email, Converter={StaticResource EmailConverter}}" /> I tried with a converter also, but in both cases with or without converter column is empty. Debugging showed that value passed to "Convert" method is always null. My question : if for any reason I want binding to Uri property , is it feasible for the latest DataGrid from Codeplex ?

    Read the article

  • How to edit boolean in a DataGridCheckBoxColumn in Silverlight 3

    - by Polo
    Hello, I have a datagrid with some TextColumn and one DataGridCheckBoxColumn. I bind it with à itemsource that contaned à boolean and i can see that my checkboxes or checked or not by the boolean everything is OK at this point. but the checkboxs cells are in ReadOnly even if i assigne IsReadOnly = False. I cant find the right and clean way to enable the editing. I dont need data validation but juste to be able to edit and check those checkboxes :) If anyone can help! thanks !!

    Read the article

  • Silverlight DataGrid Header Horizontal Alignment

    - by Brandon Montgomery
    I want to change the alignment of a header on a datagrid in Silverlight, and I can't seem to figure out how to do it. Here's what I have so far: <data:DataGridTextColumn Header="#" IsReadOnly="True" ElementStyle="{StaticResource CenterAlignStyle}" Binding="{Binding OutlineNumber, Mode=OneWay}" > <data:DataGridTextColumn.HeaderStyle> <Style TargetType="prim:DataGridColumnHeader"> <Setter Property="HorizontalAlignment" Value="Center"/> </Style> </data:DataGridTextColumn.HeaderStyle> </data:DataGridTextColumn> No matter what I try, I can't seem to change the default alignment, which appears to be "left."

    Read the article

  • Unable to display data in a WPF datagrid that has a DataView instance as the items source

    - by Jimmy W
    I am using a DataGrid object from the WPF toolkit. I am binding the DataGrid object to the default view of a DataTable instance as declared in the following code: WeatherGrid.ItemsSource = weatherDataTable.DefaultView; weatherDataTable has three columns. The first column is defined to contain a string data type. The other two columns are defined to contain double data types. When the application exits the function that calls the binding as expressed in the declaration, The DataGrid object displays data for the first column, but not the other columns. When I type the following in the immediate window in the debugger: ((DataRowView)WeatherGrid.Items[0]).Row[1] I get a number, but this doesn't correspond with what is being displayed. Why is only the first column visible, and how can I get all of the data to be visible? I'll leave my XAML definition for the DataGrid object below: <toolkit:DataGrid Margin="12.726,77.71,12,0" Name="WeatherGrid" Height="500" Grid.Row="1" VerticalAlignment="Top" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" />

    Read the article

  • Collection wrapping a array is read-only. Possible to make it writeable without casting?

    - by Brian Triplett
    I have a Collection<T> property that wraps a array like T[] array; public Collection<T> Items { get { return new Collection<T>(array); } } When I attempt to assign to the collection via: T variable; Items[i] = variable; I get a NotSupportedException because the colleciton's IsReadOnly property is true. Turns out that this is a design choice by Microsoft. Does anyone know a workaround that does NOT involve enumeration? It could be done if the underlying data is not an array but I enjoy the performance gains because the data is fixed length.

    Read the article

  • wpf datagrid on click event

    - by gencay
    I use datagrid table on my project. One of the column of the datagrid is the path of the document according to my project. I would like to do that: When the user clicks the path cell/hyperlink cell, Program will get the path, Program will open another tab. I couldn't see the onclick event for the column, how can i do this? And also how can I switch the tabitems on the same wpf Window? Hyper link column is that: < toolkit:DataGridHyperlinkColumn Header="Path" Binding="{Binding path}" IsReadOnly="True" TargetName="{Binding Path=path}"

    Read the article

  • How to save the content of Textbox into a textfile

    - by Owais Wani
    I have a textbox which has some content. I also have a button (SAVE) which shud open the FileSaveDialog and allow the content to be saved in a .txt file. XAML: <TextBox Height="93" IsReadOnly="True" Text="{Binding Path=ReadMessage, Mode=TwoWay}" Name="MessageRead" /> <Button Content="Save" Command="{Binding Path=SaveFileCommand}" Name="I2CSaveBtn" /> ViewModel: private string _readMessage = string.Empty; public string ReadMessage { get { return _readMessage; } set { _readMessage = value; NotifyPropertyChanged("ReadMessage"); } } public static RelayCommand SaveFileCommand { get; set; } private void RegisterCommands() { SaveFileCommand = new RelayCommand(param => this.ExecuteSaveFileDialog()); } private void ExecuteSaveFileDialog() { //What To Do HERE??? } What I basically need is to read the content of textbox, open a file save dialog and store it in a text file to be saved in my system.

    Read the article

  • Best Practice Method for Including Images in a DataGrid using MVVM

    - by Killercam
    All, I have a WPF DataGrid. This DataGrid shows files ready for compilation and should also show the progress of my compiler as it compiles the files. The format of the DataGrid is Image|File Path|State -----|---------|----- * |C:\AA\BB |Compiled & |F:PP\QQ |Failed > |G:HH\LL |Processing .... The problem is the image column (the *, &, and are for representation only). I have a ResourceDictionary that contains hundreds of vector images as Canvas objects: <ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Canvas x:Key="appbar_acorn" Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0"> <Path Width="22.3248" Height="25.8518" Canvas.Left="13.6757" Canvas.Top="11.4012" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 16.6309,18.6563C 17.1309,8.15625 29.8809,14.1563 29.8809,14.1563C 30.8809,11.1563 34.1308,11.4063 34.1308,11.4063C 33.5,12 34.6309,13.1563 34.6309,13.1563C 32.1309,13.1562 31.1309,14.9062 31.1309,14.9062C 41.1309,23.9062 32.6309,27.9063 32.6309,27.9062C 24.6309,24.9063 21.1309,22.1562 16.6309,18.6563 Z M 16.6309,19.9063C 21.6309,24.1563 25.1309,26.1562 31.6309,28.6562C 31.6309,28.6562 26.3809,39.1562 18.3809,36.1563C 18.3809,36.1563 18,38 16.3809,36.9063C 15,36 16.3809,34.9063 16.3809,34.9063C 16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z "/> </Canvas> </ResourceDictionary> Now, I want to be able to include these in my image column and change them at run-time. I was going to attempt to do this by setting up a property in my View Model that was of type Image and binding this to my View via: <DataGrid.Columns> <DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding Canvas}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> Where in the View Model I have the appropriate property. Now, I was told this is not 'pure' MVVM. I don't fully accept this, but I want to know if there is a better way of doing this. Say, binding to an enum and using a converter to get the image? Any advice would be appreciated.

    Read the article

  • How to resolve virtual disk degraded in Windows Server 2012

    - by harrydev
    I am using the new Storage Spaces feature in Windows Server 2012. I have the following disks: FriendlyName CanPool OperationalStatus HealthStatus Usage Size ------------ ------- ----------------- ------------ ----- ---- PhysicalDisk2 False OK Healthy Auto-Select 2.73 TB PhysicalDisk3 False OK Healthy Auto-Select 2.73 TB PhysicalDisk4 False OK Healthy Auto-Select 2.73 TB PhysicalDisk5 False OK Healthy Auto-Select 2.73 TB There is also a separate OS disk. The above disks are part of a single storage pool: FriendlyName OperationalStatus HealthStatus IsPrimordial IsReadOnly ------------ ----------------- ------------ ------------ ---------- Pool OK Healthy False False Within this storage pool some virtual disks are defined, see below: FriendlyName ResiliencySettingNa OperationalStatus HealthStatus IsManualAttach Size me ------------ ------------------- ----------------- ------------ -------------- ---- Docs Mirror OK Healthy False 500 GB Data Mirror Degraded Warning False 500 GB Work Mirror Degraded Warning False 2 TB Now the virtual disks are all running normal 2-way mirror, but two of the virtual disks are degraded. This is probably because one of the physical disks was offline for a short period of time. However, now the virtual disk cannot be repaired, even though, all physical disks are healthy. There is plenty of available space in the storage pool. This I cannot understand so I was hoping for some help, on how to resolve this? Below I have listed the full output from the Get-VirtualDisk CmdLet for the "Work" disk: ObjectId : {XXXXXXXX} PassThroughClass : PassThroughIds : PassThroughNamespace : PassThroughServer : UniqueId : XXXXXXXX Access : Read/Write AllocatedSize : 412316860416 DetachedReason : None FootprintOnPool : 824633720832 FriendlyName : Work HealthStatus : Warning Interleave : 262144 IsDeduplicationEnabled : False IsEnclosureAware : False IsManualAttach : False IsSnapshot : False LogicalSectorSize : 512 Name : NameFormat : NumberOfAvailableCopies : 0 NumberOfColumns : 2 NumberOfDataCopies : 2 OperationalStatus : Degraded OtherOperationalStatusDescription : OtherUsageDescription : Disk for data being worked on (not backed up) ParityLayout : PhysicalDiskRedundancy : 1 PhysicalSectorSize : 4096 ProvisioningType : Thin RequestNoSinglePointOfFailure : True ResiliencySettingName : Mirror Size : 2199023255552 UniqueIdFormat : Vendor Specific UniqueIdFormatDescription : Usage : Other PSComputerName :

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >