Telerik Forums
UI for WPF Forum
16 answers
1.4K+ views
Hi,

I'm having some trouble using bindings in my column headers. After reading this post: http://www.telerik.com/community/forums/wpf/gridview/binding-the-header-property-of-a-gridviewcolumn.aspx it seems like you have to have the property you are binding to available when the column is initialised, otherwise it will not get updated. 

I am wanting to bind to a property of the data context of a parent of the control that hosts the RadGridView. The DataContext hasn't been set by the time the column is initialized. Is there a way around this? I had a few ideas:

- Is there some event I can handle which is called before the columns are initialized, but after we have access to the UserControl's parent and hence its DataContext.
- Is there a way to reset the columns and hence the bindings?

I'm trying an MVVM approach, but I can't seem to fit in the ModelView approach with the column headers as I can't bind. The only way is to have the DataContext set in the control constructor, but that's fairly limited and I would rather avoid it.

Any suggestions / tips would be much appreciated!
Maya
Telerik team
 answered on 06 Jun 2016
0 answers
140 views
We have big WPF application with multiple screen. Each screen have multiple textboxes.

We have used MVVM pattern so textboxes are bound to VM using like:
{Binding Name,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}

In Most of the textboxes BUT not all, we want to set Delay Property to some value say 500 like:

{Binding Name,Delay=500,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}

Rather than setting this on each textbox xaml line is there some shorter way to handle this?

something like Style.xaml etc?
These changes are applicable for most of the textboxes but not all....
dotnetavalanche
Top achievements
Rank 1
 asked on 04 Jun 2016
1 answer
81 views

Hello,

 

I have a program I am creating where the tileview represents a collection of computers, with one tile per computer.  The data that backs this is bound as follows;

<telerik:RadTileView
    x:Name="radTileView"
    MaximizeMode="ZeroOrOne"
    ColumnWidth="250"
    ItemsSource="{Binding Data, Source={StaticResource context}}"
    ItemTemplate="{StaticResource ItemTemplate}"
    ContentTemplate="{StaticResource ContentTemplate}"
    IsVirtualizing="True"
    RowHeight="250"
    Grid.Column="2"
    Grid.Row="0"
    Margin="8,1,10,10"
    />

In my ViewModel, Data is an observable collection, like this;

private ObservableCollection<ImagingData> _imagingData = new ObservableCollection<ImagingData>();
public ObservableCollection<ImagingData> Data
{
    get
    {
        return _imagingData;
    }
    set
    {
        _imagingData = value;
        OnPropertyChanged(() => this.Data);
    }
}

Data is updated by a timer event that polls a database backend.  If i simply update Data by replacing it, everything works fine, except it makes for a poor UI experience since the pane resets constantly. To make for a better experience, where tiles stay maximized, and stay where you put them, i implemented a sort of delta sync.  When the timer event pops, I call UpdateData() with the UI dispatcher.  UpdateData copies Data to an array, then adds new records, deletes records that are not in scope anymore, and updates fields on records that already exist.  it is a crude proof of concept, but here it is;

private void UpdateData(ImagingData[] newItems, ImagingData[] existing)
{
    //var dataArray = _imagingData.ToArray();
    foreach (var item in existing)
    {
        var matchedItem = newItems.Where(c => c.ComputerName == item.ComputerName).FirstOrDefault();
 
        if (matchedItem == null)
            Data.Remove(item);
    }
 
    foreach (var item in newItems)
    {
        var matchedItem = existing.Where(c => c.ComputerName == item.ComputerName).FirstOrDefault();
 
        if(matchedItem == null)
        {
           Data.Add(item);
            return;
        }
 
        matchedItem.ImagingPasses = item.ImagingPasses;
        matchedItem.LastKnownActivity = item.LastKnownActivity;
        matchedItem.ImagingState = item.ImagingState;
    }
 
    OnPropertyChanged("Data");
}

The problem I am having that when i use this method, only 1 record is added to the Data collection each time the update timer fires, even though I have confirmed that the update loop does iterate over all the members.  Visually, you see one tile appear, then the next, then the next, etc, separated by one timer iteration.  I have tried all manner of different ways to remedy this but nothing seems to work.

Matt
Top achievements
Rank 1
 answered on 03 Jun 2016
5 answers
360 views
In RadTimePicker, click the toggle button, the drop down screen shows up.
Since we layout the RadTimePicker in right side main screen, the drop down screen seems to wider, it crosses the main window boundary. See the attachment.
Is there a way we can change the drop down screen width, so it will not cross the main window boundary?
thx!
Jane
M L
Top achievements
Rank 1
 answered on 03 Jun 2016
1 answer
75 views

I get an XmlParseException when I place a RadDiagram control at the same level as a RadDocking control and attempt to run.

<Window x:Class="TelerikWpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<telerik:RadDiagram>
</telerik:RadDiagram>
<telerik:RadDocking Grid.Column="2">
</telerik:RadDocking>

</Grid>
</Window>

 

System.Windows.Markup.XamlParseException occurred
  HResult=-2146233087
  LineNumber=14
  LinePosition=11
  Message=Could not load file or assembly 'Telerik.Windows.Controls, Version=2016.2.503.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=PresentationFramework
  StackTrace:
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at TelerikWpfApp1.MainWindow.InitializeComponent() in D:\visual studio 2015 Projects\TelerikWpfSolution\TelerikWpfApp1\MainWindow.xaml:line 1
  InnerException:
       FileName=Telerik.Windows.Controls, Version=2016.2.503.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
       FusionLog==== Pre-bind state information ===
LOG: DisplayName = Telerik.Windows.Controls, Version=2016.2.503.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
 (Fully-specified)
LOG: Appbase = file:///D:/visual studio 2015 Projects/TelerikWpfSolution/TelerikWpfApp1/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Telerik.Windows.Controls.Docking, Version=2016.2.503.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\visual studio 2015 Projects\TelerikWpfSolution\TelerikWpfApp1\bin\Debug\TelerikWpfApp1.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Telerik.Windows.Controls, Version=2016.2.503.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
LOG: Attempting download of new URL file:///D:/visual studio 2015 Projects/TelerikWpfSolution/TelerikWpfApp1/bin/Debug/Telerik.Windows.Controls.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
       HResult=-2146234304
       Message=Could not load file or assembly 'Telerik.Windows.Controls, Version=2016.2.503.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
       Source=mscorlib
       StackTrace:
            at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
            at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
            at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
            at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
            at System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
            at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
            at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
            at System.Windows.Baml2006.Baml2006Reader.Read()
            at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
            at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       InnerException:

Dinko | Tech Support Engineer
Telerik team
 answered on 03 Jun 2016
1 answer
160 views

Hello team,

I'm trying to acces IsReadOnly property from header style to change its foreground color. For now, I didn't find a solution. I'm trying the following:

<Style x:Key="GridViewHeaderCellStyle" TargetType="{x:Type telerik:GridViewHeaderCell}">

...

<Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewDataColumn}}, Path=Column.IsReadOnly}" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource primaryBrush}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

Martin
Telerik team
 answered on 03 Jun 2016
1 answer
208 views
Trying to figure out the best way via code to paste from a word document (using interop) a fragment of formatted text to a RichTextEditor as Html that is filtered. I can easily just paste, but then it seems I get a whole bunch of Word specific format. I want to paste filtered text. How would I go about this?
Tanya
Telerik team
 answered on 03 Jun 2016
1 answer
184 views

I'm sure this is trivial, but I don't see a property that would make it happen.  I'd like to make my entire GanttView read-only, so that it doesn't permit any changes to dates or tasks either in the text columns or by dragging tasks around.  I've tried setting "IsEnabled" to false, but that prevents me from resizing the columns.  Suggestions?

Thanks!

Brad.

Yana
Telerik team
 answered on 02 Jun 2016
1 answer
76 views

Hello,

I have a flollowing problem in the RadChart control. I've defined brushes like this  

                    <telerik:RadChart.PaletteBrushes>
                        <SolidColorBrush Color="Green" />
                        <SolidColorBrush Color="Gray" />
                        <SolidColorBrush Color="Orange" />
                    </telerik:RadChart.PaletteBrushes>

which works fine,but I wanted to reuse this in many places if possible. How can I do it?

Alternatively can I set a Brush for each slice via Binding? My viewmodel for the slice has a Brush property let's say MyBrush. Is there a way to bind it in a series definition?

 

Thanks in advance!

Krzysztof

 

Dinko | Tech Support Engineer
Telerik team
 answered on 02 Jun 2016
2 answers
108 views

Launch the Telerik WPF Demos, and go to the "Filtering Configuration" demo.

Change the FilteringMode to FilterRow

Type some text in one of the filter textboxes

Using your mouse, attempt to click and drag to highlight this text.

The column reordering mechanism of the grid kicks in, instead of highlighting the text as would be expected.

 

Is there any way to change this behaviour?

 

Thanks

Steve
Top achievements
Rank 1
 answered on 01 Jun 2016
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?