Telerik Forums
UI for WPF Forum
2 answers
300 views

Hi!

I have 2 panels, first one for details from every row and second one to show all rows via RadGridView like this:

<Grid x:Nme="pnlDetalle">

<Label x:Name="lblCodigo" Content="Código" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="8,8.5,76,8.499"/>
<telerik:RadMaskedTextBox x:Name="fmtCodigo" IsEnabled="False" Style="{DynamicResource Estilo1MaskedTextBox}" Value="{Binding ElementName=grdGridConsulta, Path=SelectedItem.CA001, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Margin="87,0,0,8.5" HorizontalAlignment="Left" Width="51.92" VerticalAlignment="Bottom" TabIndex="0" />
   Label x:Name="lblTitulo" Content="Titulo" Margin="21,84,0,0" VerticalAlignment="Top" Width="77" Height="27"/>
<TextBox x:Name="txtTitulo" Style="{StaticResource Estilo1TextBox}" Text="{Binding ElementName=grdGridConsulta, Path=SelectedItem.CA002, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" HorizontalAlignment="Left" Margin="102,84,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="27" TabIndex="1" Width="230"/>
<Label x:Name="lblEjecutable" Content="Ejecutable" Margin="21,121,0,0" VerticalAlignment="Top" Width="77" Height="27"/>
<TextBox x:Name="txtEjecutable" Style="{StaticResource Estilo1TextBox}" Text="{Binding ElementName=grdGridConsulta, Path=SelectedItem.CA003, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" HorizontalAlignment="Left" Margin="102,121,0,0" TextWrapping="Wrap" VerticalAlignment="Top" TabIndex="2" Width="301" Height="27"/>
<Label x:Name="lblID" Content="ID" Margin="21,159,0,0" VerticalAlignment="Top" Width="77" Height="27"/>
<TextBox x:Name="txtID" Style="{StaticResource Estilo1TextBox}" Text="{Binding ElementName=grdGridConsulta, Path=SelectedItem.CA004, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" HorizontalAlignment="Left" Margin="102,159,0,0" TextWrapping="Wrap" Height="27" VerticalAlignment="Top" TabIndex="3" Width="128"/>
<telerik:RadToggleButton x:Name="chkInactivo" Content="Inactivo?" IsChecked="{Binding ElementName=grdGridConsulta, Path=SelectedItem.CA005, Mode=TwoWay, Converter={StaticResource ValueConverter}}" Style="{StaticResource EstiloCheckBox}" HorizontalAlignment="Left" Margin="21,202.98,0,0" Width="86" Height="22" VerticalAlignment="Top" TabIndex="4">
<telerik:RadToggleButton.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFEBEBEB" Offset="0.074"/>
<GradientStop Color="#FFD2D2D2" Offset="0.93"/>
<GradientStop Color="#FFC6C6C6" Offset="0.561"/>
<GradientStop Color="#FFEDEDED" Offset="0.504"/>
<GradientStop Color="#FFF3F3F3" Offset="1"/>
<GradientStop Color="White" Offset="0.017"/>
</LinearGradientBrush>
</telerik:RadToggleButton.Background>
</telerik:RadToggleButton>
</Grid>

<Grid x:Name="pnlConsulta" Height="322">
<telerik:RadGridView x:Name="grdGridConsulta" ItemsSource="{Binding}" Margin="19,20.675,23,8" ShowGroupPanel="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutoGenerateColumns="False" ColumnWidth="Auto" CanUserInsertRows="False" IsReadOnly="True">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="[lblCodigo]" DataMemberBinding="{Binding CA001, Mode=TwoWay}" UniqueName="CA001" HeaderTextAlignment="Center" TextAlignment="Right"/>
<telerik:GridViewDataColumn Header="[lblTitulo]" DataMemberBinding="{Binding CA002, Mode=TwoWay}" UniqueName="CA002" HeaderTextAlignment="Center"/>
<telerik:GridViewDataColumn Header="[lblEjecutable]" DataMemberBinding="{Binding CA003, Mode=TwoWay}" UniqueName="CA003" HeaderTextAlignment="Center"/>
<telerik:GridViewDataColumn Header="[lblID]" DataMemberBinding="{Binding CA004, Mode=TwoWay}" UniqueName="CA004" HeaderTextAlignment="Center"/>
<telerik:GridViewCheckBoxColumn Header="[chkInactivo]" DataMemberBinding="{Binding CA005, Mode=TwoWay, Converter={StaticResource ValueConverter}}" UniqueName="CA005" HeaderTextAlignment="Center"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>

however when I change text into any TextBox, cells into radgridView doesn't reflect changes, I guess due to IsReadOnly="True" property I Set as I need only from Details panel users can make changes, so:

1 - I need those changes be reflected in radGridView, how can I do this?

2 - RadgridView is binded by DataContext where source is a DataTable.DefaultView. My second question is, Any changes happen in cells affects automatically data rows into DataTable? - I need this happen in this way

Thanks for your help

ENTERPRISE INTERNATIONAL SAS
Top achievements
Rank 1
 answered on 14 Sep 2010
6 answers
153 views
Hello,
Very easy scenario, I have a listbox in TileviewItem 1.

When I select a ListboxItem I want pass some of the data to the other TIles.

I'm able to bind Data to the  RadfluidContentControl.SmallContent and Normal Content(restore).
The issue is it drops the binding in the RadFluidContentControl.LargeContent.  

If your only binding to One .LargeContent it's fine, when your binding to another its drops the first binding.

Thoughts, 
Rick Mueller
Rick Mueller
Top achievements
Rank 1
 answered on 14 Sep 2010
2 answers
219 views

Hi!

I have a radgridview readonly = true bounded to a DataTable datasource DataContext. Also I have a details panel with textboxes binding like ElementName=grdGridConsulta, Path=Selected.Column, Mode=TwoWay, UpdateSourceTrigger=Explicit.

To Insert a new row and put textBoxes empty I had to do following:

grdGridConsulta.IsReadOnly = false;
grdGridConsulta.BeginInsert();
grdGridConsulta.IsReadOnly = true;
 

this add a new row to the grid and automatically blank every textboxes and set isReadOnly=true again. I put text on textboxes and next save changes, so, I do like this txtID.GetBindingExpression(TextBox.TextProperty).UpdateSource(); when this happen, grdGridConsulta source doesn't reflect changes from target, but if I add this code line - grdGridConsulta.Rebind(); - grdGridConsulta reflects changes from target. Is it necessary Rebind to accomplish the update???

thanks

P.D: please, I left waiting for an older question not answered not even to know answer is not known.

ENTERPRISE INTERNATIONAL SAS
Top achievements
Rank 1
 answered on 14 Sep 2010
8 answers
210 views
Hi,

  • i have to bind a Textbox to a current cell.value (Excel-like Editbox behavior, if you type into  a gridcell the typed char appears directly in the Textbox and vice-versa).

  • UpdateSourceTrigger=PropertyChanged seems not to work with a gridcell.

  • Text="{Binding ElementName=RadGridView1, Path=CurrentCell.Value} doesn't work ?

regards,
Juergen
juergen
Top achievements
Rank 1
 answered on 14 Sep 2010
3 answers
133 views
Hello,
I wanted to change the filter labels and localize them,
I used the LocalizationManager and it works fine,
However for three type of data, I'd like to display three type of labels, which are (numerics, DateTime, and strings)
I couldn't manage to localize these different columns with different resource files,
So went through the following solutions  :
Solution I
created a new style/Template for the FilteringControl and applied this style to the control as shown bellow:
<ResourceDictionary>

<local:ImageTypeConverter x:Key="imageTypeConverter"></local:ImageTypeConverter><local:ContainsKeywordsIconConverter x:Key="containsKeywordsIconConverter"></local:ContainsKeywordsIconConverter> <ResourceDictionary.MergedDictionaries>

 

 

 

<ResourceDictionary Source="../Themes/Resources/Dictionaries/FilteringControlStyle.xaml"/>

 

</ResourceDictionary.MergedDictionaries>

 

</ResourceDictionary>

 

 

<telerik:GridViewDataColumn Header="Date" UniqueName="Date"   DataMemberBinding="{Binding DateCreation}" HeaderCellStyle="{StaticResource CustomHeaderCell}">

  

 

                  <telerik:GridViewDataColumn.FilteringControl >
                      <telerik:FilteringControl ></telerik:FilteringControl>
                  </telerik:GridViewDataColumn.FilteringControl>
              </telerik:GridViewDataColumn>
Doing this, the PART_DistinctValuesList is not   filled up with any data, neither the filter expressions is.
Solution II
Created a new control by copy/pasting the previouse style definition of the FilteringControl as shown bellow
 

<Border Margin="0,2,0,0" BorderBrush="#FF848484" BorderThickness="1,1,1,1" CornerRadius="1">

 

<Border Background="#FFE4E4E4" BorderBrush="White" BorderThickness="1">
<StackPanel HorizontalAlignment="Stretch" Margin="5,5,5,5" MaxWidth="350" MinWidth="200" VerticalAlignment="Stretch">

 

<StackPanel x:Name="PART_DistinctFilter" Visibility="Visible">

 

........Up to the end,

Of course, my usercontrol implements  IFilteringControl as stated in the help tutorial
But here I must redefine all actions of the controls, (Onfilter, onclear, selectAll and so on...)

Is there some missing thing I could add in either one of both solutions to overcome the corresponding shortcut ? or  I must continue in the second solution by codding all necessary actions ? which seems to be a bit heavy for just localizing differents columns filters with different resources files,

Thanks in advance for your help,
Abdelkader

 


 

 

 

Maya
Telerik team
 answered on 14 Sep 2010
1 answer
125 views
I have a grid which has a HierarchyChildTemplate .I want the HierarchyChildTemplate in the first row only to be expanded by default. Is there a way to do this?

Thanks,

Billy Jacobs 
Milan
Telerik team
 answered on 14 Sep 2010
1 answer
105 views
Hi,

i have a treeview in my app, and its databoud to data using a HierarchicalDataTemplate
how can i stop certian flagged nodes from been dragged into the root of the treeview?
i need them to be draggable to anyother node, but not the root.

cheers
Kiril Stanoev
Telerik team
 answered on 14 Sep 2010
1 answer
83 views
Hi,

I have a RadDateTimePicker sitting inside a Infragistics docking manager, and the date selection pop up window does not display when you click the date/time selection button.  If I move the RadDateTimePicker outside of the Infragistics docking manager, the control works fine.  Is this a known issue?

TIA.
Kaloyan
Telerik team
 answered on 14 Sep 2010
1 answer
79 views
Hello Telerik,

I wanted to develop a control which should surve the following features,

it should be a selectionlist control,

having features like,

 

  • Must support images/text at the lists
  • Must support multi selection
  • Must generate events where I add new elements at one of the two lists
  • Can sort content of the lists
  • Data will be introduced from an XML file or Database
  • Must support data groups
  • Must have the option of select only "selected elements" or all the items
  • Must return the list of selected items


Did you have any control that provides above features ?

Regards,
Srinivas

 

Rossen Hristov
Telerik team
 answered on 14 Sep 2010
1 answer
128 views
Hi,

We are implementing a custom menu bar for which RadMenu is the underlying control using template approach (controltemplate).

We are able to bind all properties but coming to UI part, our custom control is just showing the menubar with the header items and when we click on
any menuitem, the sub menu's are not showing up.

We couldn't figure what was the actual problem here.

We hope you can give a helping hand in this regard.

Below is the code snippet for generic.xaml......

 

 

 

<Style TargetType="local:TngMenuBar">

 

 

 

 

<Setter Property="Background"

 

 

 

Value="White" />

 

 

 

 

<Setter Property="Foreground"

 

 

 

Value="Black" />

 

 

 

 

<Setter Property="BorderBrush"

 

 

 

Value="Black" />

 

 

 

 

<Setter Property="BorderThickness"

 

 

 

Value="1" />

 

 

 

 

<Setter Property="Template">

 

 

 

 

<Setter.Value>

 

 

 

 

<ControlTemplate TargetType="local:TngMenuBar">

 

 

 

 

<ControlsNavigation:RadMenu Name="PART_TngMenuBar"

 

 

 

DataContext="{TemplateBinding Property=DataContext}"

 

 

 

ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"

 

 

 

ItemTemplate="{TemplateBinding Property=ItemTemplate}"

 

 

 

ItemTemplateSelector="{TemplateBinding Property=ItemTemplateSelector}"

 

 

 

ItemContainerStyle="{TemplateBinding Property=ItemContainerStyle}"

 

 

 

ItemContainerStyleSelector="{TemplateBinding Property=ItemContainerStyleSelector}"

 

 

 

FontSize="{TemplateBinding Property=FontSize}"

 

 

 

FontStyle="{TemplateBinding Property=FontStyle}"

 

 

 

Foreground="{TemplateBinding Property=Foreground}"

 

 

 

ClickToOpen="{TemplateBinding Property=ClickToOpen}"

 

 

 

ShowDelay="{TemplateBinding Property=ShowDelay}"

 

 

 

HideDelay="{TemplateBinding Property=HideDelay}"

 

 

 

Orientation="{TemplateBinding Property=Orientation}"

 

 

 

>

 

 

 

 

 

</ControlsNavigation:RadMenu>

 

 

 

 

 

</ControlTemplate>

 

 

 

 

</Setter.Value>

 

 

 

 

</Setter>

 

 

 

 

 

 

</Style>

 

 

 

 

<Style TargetType="local:TngMenuItem">

 

 

 

 

 

<Setter Property="Template">

 

 

 

 

<Setter.Value>

 

 

 

 

<ControlTemplate TargetType="local:TngMenuItem">

 

 

 

 

<ControlsNavigation:RadMenuItem Name="PART_TngMenuBarItem"

 

 

 

Header="{TemplateBinding Property=Header}"

 

 

 

></ControlsNavigation:RadMenuItem>

 

 

 

 

</ControlTemplate>

 

 

 

 

</Setter.Value>

 

 

 

 

</Setter>

 

 

 

 

</Style>

 


Below is the code snippet for our custom control Menubar.cs code......

 

 

public class TngMenuBar : Control

 

{

#region

 

 

Constructors

 

 

 

public TngMenuBar()

 

{

DefaultStyleKey =

 

typeof(TngMenuBar);

 

Items =

 

new TngMenuBarItemCollection();

 

 

 

 

}

#endregion

 

 

 

public static DependencyProperty ItemsProperty = DependencyProperty.Register(

 

 

 

"Items",

 

 

 

typeof(TngMenuBarItemCollection),

 

 

 

typeof(TngMenuBar),

 

 

 

null);

 

 

 

public TngMenuBarItemCollection Items

 

{

 

 

get { return this.GetValue(ItemsProperty) as TngMenuBarItemCollection; }

 

 

 

set { this.SetValue(ItemsProperty, value); }

 

}

 

 

 

public event RoutedEventHandler ItemClick;

 

 

 

void TngMenu_MouseLeftButtonUp(object sender,

 

 

 

MouseButtonEventArgs e)

 

{

 

 

if (ItemClick != null)

 

ItemClick(

 

this, new RoutedEventArgs());

 

}

 

 

 

 

public override void OnApplyTemplate()

 

{

 

 

base.OnApplyTemplate();

 

 

 

 

RadMenu menu = this.GetTemplateChild("PART_TngMenuBar") as RadMenu;

 

 

 

if (menu == null)

 

 

 

return;

 

 

 

 

for (int i = 0; i < this.Items.Count; i++)

 

{

 

 

TngMenuItem menuItem = this.Items[i];

 

 

menu.Items.Add(menuItem);

}

}

#region

 

 

Property: DataContext

 

 

 

private Object _dataContext;

 

 

 

public Object DataContext

 

{

 

 

get { return GetValue(DataContextProperty); }

 

 

 

set { SetValue(DataContextProperty, value); }

 

}

 

 

public static readonly DependencyProperty DataContextProperty =

 

 

 

DependencyProperty.Register(

 

 

 

"DataContext", typeof(Object), typeof(TngMenuBar),

 

 

 

new PropertyMetadata((o, e) =>

 

{

((

 

TngMenuBar)o).UpdateDataContext((Object)e.NewValue);

 

}));

 

 

 

private void UpdateDataContext(Object sel)

 

{

_dataContext = sel;

}

#endregion

#region

 

 

Property: ItemsSource

 

 

 

private IEnumerable _itemsSource;

 

 

 

public IEnumerable ItemsSource

 

{

 

 

get { return (IEnumerable)GetValue(ItemsSourceProperty); }

 

 

 

set { SetValue(ItemsSourceProperty, value); }

 

}

 

 

public static readonly DependencyProperty ItemsSourceProperty =

 

 

 

DependencyProperty.Register(

 

 

 

"ItemsSource", typeof(IEnumerable), typeof(TngMenuBar),

 

 

 

new PropertyMetadata((o, e) =>

 

{

((

 

TngMenuBar)o).UpdateItemsSource((IEnumerable)e.NewValue);

 

}));

 

 

private void UpdateItemsSource(IEnumerable sel)

 

{

_itemsSource = sel;

}

#endregion

#region

 

 

Property: ItemTemplate

 

 

 

private DataTemplate _itemTemplate;

 

 

 

public DataTemplate ItemTemplate

 

{

 

 

get { return (DataTemplate)GetValue(ItemTemplateProperty); }

 

 

 

set { SetValue(ItemTemplateProperty, value); }

 

}

 

 

public static readonly DependencyProperty ItemTemplateProperty =

 

 

 

DependencyProperty.Register(

 

 

 

"ItemTemplate", typeof(DataTemplate), typeof(TngMenuBar),

 

 

 

new PropertyMetadata((o, e) =>

 

{

((

 

TngMenuBar)o).UpdateItemTemplate((DataTemplate)e.NewValue);

 

}));

 

 

private void UpdateItemTemplate(DataTemplate sel)

 

{

_itemTemplate = sel;

}

#endregion

#region

 

 

Property: ItemTemplateSelector

 

 

 

private DataTemplateSelector _itemTemplateSelector;

 

 

 

public DataTemplateSelector ItemTemplateSelector

 

{

 

 

get { return (DataTemplateSelector)GetValue(ItemTemplateSelectorProperty); }

 

 

 

set { SetValue(ItemTemplateSelectorProperty, value); }

 

}

 

 

public static readonly DependencyProperty ItemTemplateSelectorProperty =

 

 

 

DependencyProperty.Register(

 

 

 

"ItemTemplateSelector", typeof(DataTemplateSelector), typeof(TngMenuBar),

 

 

 

new PropertyMetadata((o, e) =>

 

{

((

 

TngMenuBar)o).UpdateItemTemplateSelector((DataTemplateSelector)e.NewValue);

 

}));

 

 

private void UpdateItemTemplateSelector(DataTemplateSelector sel)

 

{

_itemTemplateSelector = sel;

}

#endregion

#region

 

 

Property: ItemContainerStyle

 

 

 

private Style _itemContainerStyle;

 

 

 

public Style ItemContainerStyle

 

{

 

 

get { return (Style)GetValue(ItemContainerStyleProperty); }

 

 

 

set { SetValue(ItemContainerStyleProperty, value); }

 

}

 

 

public static readonly DependencyProperty ItemContainerStyleProperty =

 

 

 

DependencyProperty.Register(

 

 

 

"ItemContainerStyle", typeof(Style), typeof(TngMenuBar),

 

 

 

new PropertyMetadata((o, e) =>

 

{

((

 

TngMenuBar)o).UpdateItemContainerStyle((Style)e.NewValue);

 

}));

 

 

private void UpdateItemContainerStyle(Style sel)

 

{

_itemContainerStyle = sel;

}

#endregion


Below is the code snippet for our custom control MenuItem.cs code......

 

 

 

public class TngMenuItem:ContentControl

 

 

 

 

 

 

{

 

 

 

 

 

#region

 

 

Constructors

 

 

 

public TngMenuItem()

 

{

DefaultStyleKey =

 

typeof(TngMenuItem);

 

Items =

 

new TngMenuBarItemCollection();

 

}

 

 

 

 

#endregion

 

 

 

 

 

 

 

public static DependencyProperty ItemsProperty = DependencyProperty.Register(

 

 

 

"Items",

 

 

 

typeof(TngMenuBarItemCollection),

 

 

 

typeof(TngMenuItem),

 

 

 

null);

 

 

 

public TngMenuBarItemCollection Items

 

{

 

 

get { return this.GetValue(ItemsProperty) as TngMenuBarItemCollection; }

 

 

 

set { this.SetValue(ItemsProperty, value); }

 

}

 

 

public override void OnApplyTemplate()

 

{

 

 

base.OnApplyTemplate();

 

 

 

 

RadMenuItem menuitem = this.GetTemplateChild("PART_TngMenuBarItem") as RadMenuItem;

 

 

 

if (menuitem == null)

 

 

 

return;

 

 

 

for (int i = 0; i < this.Items.Count; i++)

 

{

 

 

TngMenuItem cmi = this.Items[i];

 

 

menuitem.Items.Add(cmi);

}

}

 

 

 

 

 

 

#region

 

 

Property: Header

 

 

 

private Object _header;

 

 

 

public virtual Object Header

 

{

 

 

get { return GetValue(HeaderProperty); }

 

 

 

set { SetValue(HeaderProperty, value); }

 

}

 

 

public static readonly DependencyProperty HeaderProperty =

 

 

 

DependencyProperty.Register(

 

 

 

"Header", typeof(Object), typeof(TngMenuItem),

 

 

 

new PropertyMetadata((o, e) =>

 

{

((

 

TngMenuItem)o).UpdateHeader((Object)e.NewValue);

 

}));

 

 

private void UpdateHeader(Object sel)

 

{

_header = sel;

}

 

 

 

 

#endregion

Below is the code snippet for our custom control MenuItemcollection.cs code......

 

 

 

public class TngMenuBarItemCollection : ObservableCollection<TngMenuItem>

 

{

}

 

 



 

Pana
Telerik team
 answered on 14 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?