Telerik Forums
UI for WPF Forum
4 answers
570 views

Hello,

I have a RadGridView with child RadGridView . Both grids have a GridViewColumn whose visibility I would like to bind to a Property in my Model. This is working for the parent grid, but the child grid isn't in the right DataContext to access the property in my model.

The tables, stripped down for brevity:

 <telerik:RadGridView  AutoGenerateColumns="False" ItemsSource="{Binding ProductTypes.View}">
                        <telerik:RadGridView.ChildTableDefinitions>
                            <telerik:GridViewTableDefinition>
                                <telerik:GridViewTableDefinition.Relation>
                                    <telerik:PropertyRelation ParentPropertyName="kcc_IncentiveProductTypeChildren" />
                                </telerik:GridViewTableDefinition.Relation>
                            </telerik:GridViewTableDefinition>
                        </telerik:RadGridView.ChildTableDefinitions>

                        <telerik:RadGridView.Columns>
                           
                            <telerik:GridViewColumn  IsVisible="{Binding DataContext.CanView, ElementName=LayoutRoot}" >
                                <telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="Delete"/>
                                    </DataTemplate>
                                </telerik:GridViewColumn.CellTemplate>
                            </telerik:GridViewColumn>
                        </telerik:RadGridView.Columns>
                        <telerik:RadGridView.HierarchyChildTemplate>
                            <DataTemplate>
                                <telerik:RadGridView  ItemsSource="{Binding kcc_IncentiveProductTypeChildren}" AutoGenerateColumns="False"  >
                                  
                                    <telerik:RadGridView.Columns>
                                       
                                        <telerik:GridViewColumn  IsVisible="{Binding DataContext.CanView, ElementName=LayoutRoot}" >
                                            <telerik:GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Button Content="Delete"/>
                                                </DataTemplate>
                                            </telerik:GridViewColumn.CellTemplate>
                                        </telerik:GridViewColumn>

                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </DataTemplate>
                        </telerik:RadGridView.HierarchyChildTemplate>
                    </telerik:RadGridView>

 

I need a way to bind to the IsVisible property of the GridViewColumn in the child Grid.

I considered applying a style from my static resources to the GridViewColumn to set the IsVisible property, but GridViewColumn does not have a Style property! I am not sure, but I don't think the other styles (header/footer/cell) will work on this property of the GridViewColumn.

        <Style TargetType="telerik:GridViewColumn" x:Key="ViewPermissionColumn">
            <Setter Property="IsVisible"  Value="{Binding DataContext.CanView, ElementName=LayoutRoot}" />
        </Style>

 

As a last option, I assume I'll need to handle an event on the main grid in order to set this value manually in the code behind. What event would I need?

 

 

 

 

 

jen
Top achievements
Rank 1
 answered on 21 Apr 2016
0 answers
95 views

My use case requires programmatically detecting when a NumericUpDown control is currently being edited, so that we can disallow the user from clicking a button before they've committed their value.

Currently I'm using the Got/LostKeyboardFocus events as well as the setter of the value that the NUD is bound to, but there are many cases in which this approach is insufficient. Ideally, the NUD would have a property I could bind to that would indicate when the NUD is being edited but I haven't found any such thing.

Thanks in advance!

Jules
Top achievements
Rank 1
 asked on 21 Apr 2016
1 answer
101 views

Hello,

 

I'm having a bit of trouble connecting my mobile device to TestStudio for testing via USB.  I can get the machine to read that the device is connected but I'm afraid I'm not able to find the port number of the device hooked up via USB.  I'm stuck at this point, I've tried every port number  that I could possibly think of... perhaps I'm looking in the wrong place for a port number reference.  Any help would be appreciated. 

 

(Device is a Samsung mobile phone)

Nikolay Petrov
Telerik team
 answered on 21 Apr 2016
6 answers
808 views

Hello,

I have a RadComboBox that uses an ItemTemplate to style the content within the dropdown.  The ComboBox binds to a "lookup" object that has "Id", "Value", "FG" and "BG" properties.  "FG" is the foreground color (string) and "BG" is the background color (string).  Value is the display text, and Id is the underlying ID value of the object from the database.

I have the combobox bound to the actual Lookup object, rather than to a primitive, the ItemsSource is bound to another object which is a list of Lookup objects, and I have an item template:

<DataTemplate x:Key="lookupColor">
    <Label x:Name="lbl"
           Background="{Binding BG}"
           Content="{Binding Value}"
           Foreground="{Binding FG}"
           Margin="0">
    </Label>
</DataTemplate>

This works great for a standard combobox.  The background is filled in and text color is set properly in both the dropdown, and the items list.  But when I try to make the combobox editable, so the user can type the text to quickly select an item, the result shows the <bound class name string> in the textbox for the selected item, instead of the content value binding.  I even tried setting the "DisplayMemberPath" to "Value", but still nothing. 

I extracted the ComboBox template through expression blend, but there doesn't appear to be any binding on the textbox to control the content, leaving me to think the text is controlled by code.

Any ideas on this?

Gord
Top achievements
Rank 1
 answered on 21 Apr 2016
11 answers
206 views
Can this be done? 

See example in this thread:
http://www.telerik.com/community/forums/wpf/docking/savelayout-when-ishidden-is-binding.aspx

Using the example 317519_Docking-DataContext-SL-2.zip (though converted to WPF), I find IsHidden does not get restored from LoadLayout.  If I remove the binding it works fine.  But I need the binding.

Any ideas?
Kalin
Telerik team
 answered on 21 Apr 2016
4 answers
131 views
Hello, 
How can I set foreground property for cells of GridViewHyperlinkColumn in xaml ?
Thank you in advance,
Maya
Maya
Top achievements
Rank 1
 answered on 21 Apr 2016
1 answer
129 views

In my application , i use ShapeStyleSelector  to show diference  style,  the styles is differentiated by  the binding object's property,  the property may change in  app run time, so i need to change the node style dynamic.   at present,   when  user change the property,  i remove the node and add one with another style, This is not a good solution

Is any resolution to resole the problem ?

Petar Mladenov
Telerik team
 answered on 21 Apr 2016
6 answers
206 views

Hello.

 

I want to represent my model(see attached image) with TreeListView.

 

I have achieved to display process, work and drill instructions, but I dont know how to display Tasks and Programs.(see attached image)

 

A example of my hierachy maybe that:

ROOT(Process)
  |__ Process_1
                  |__ Process_1.1


                  |__ Drill
  |__ Work_2
                  |__ Task1
                  |__ Task2

 

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 21 Apr 2016
6 answers
333 views

Hi,

I have a RadCartesianChart control showing 2 ScatterLineSeries, I want to have the Trackball behavior only in one of the series, I added templates with an empty instance of DataTemplate like this:

<telerik:ScatterLineSeries.TrackBallInfoTemplate>
                                                    <DataTemplate/>
                                                </telerik:ScatterLineSeries.TrackBallInfoTemplate>
 
                                                <telerik:ScatterLineSeries.TrackBallTemplate>
                                                    <DataTemplate/>
                                                </telerik:ScatterLineSeries.TrackBallTemplate>

This way I don't show the popup neither the indicator, but I still have the snap effect.

Is it possible to hide or remove the snap effect on one series?

Regards,

Alberto

 

 

Amige
Top achievements
Rank 1
Veteran
 answered on 20 Apr 2016
1 answer
94 views
Hi,

 

I am trying to get a series of tab RichTextEditors to return formatted text as html markup fragments, and not the fully-qualified HTML doc.  We use this same RichTextEdit elsewhere which honors the formatting settings to return fragments (but not in a tab control), but in the context below, it always returns the default full html doc no matter what.  Originally this was using a resource dictionary, but I inlined the HTMLDataProvider to try to isolate the problem

 
<telerik:RadTabControl Style="{DynamicResource TabControlNoHeaderBackground}" ItemsSource="{Binding Disclosures}">
    <telerik:RadTabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding DisclosureTypeName}" />
        </DataTemplate>
    </telerik:RadTabControl.ItemTemplate>
    <telerik:RadTabControl.ContentTemplate>
        <DataTemplate>
            <Grid>
                <telerik:HtmlDataProvider x:Name="CustomerHtmlDataProvider"
                                          Html="{Binding Content, Mode=TwoWay}"
                                          RichTextBox="{Binding ElementName=TxtDisclosureContent}">
                    <telerik:HtmlDataProvider.FormatProvider>
                        <telerik:HtmlFormatProvider>
                            <telerik:HtmlFormatProvider.ExportSettings>
                                <telerik:HtmlExportSettings
                                    DocumentExportLevel="Fragment"
                                    ImageExportMode="None"
                                    ExportFontStylesAsTags="True"
                                    ExportStyleMetadata="False">
                                </telerik:HtmlExportSettings>
                            </telerik:HtmlFormatProvider.ExportSettings>
                        </telerik:HtmlFormatProvider>
                    </telerik:HtmlDataProvider.FormatProvider>
                </telerik:HtmlDataProvider>
                <telerik:RadRichTextBox x:Name="TxtDisclosureContent" IsSpellCheckingEnabled="False" />
            </Grid>
        </DataTemplate>
    </telerik:RadTabControl.ContentTemplate>
</telerik:RadTabControl>
Mihail
Telerik team
 answered on 20 Apr 2016
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?