Telerik Forums
UI for WPF Forum
0 answers
132 views
My currently program allows multiple instances of Views and using the code from the link below the SelectedItems property doesn't update for any instances created after the first. The first will always be update and trigger. 

    <telerik:RadGridView  ItemsSource="{Binding Items, Mode=TwoWay}"
                                        SelectedItem="{Binding SelectedTransaction, Mode=TwoWay}" " 
                                        IsEnabled="{Binding IsNotBusy, Mode=OneWay}"                                    
                                        SelectionMode="Extended"
                                        Framework:MultiSelectBehavior.SelectedItems="{Binding SelectedTransactions, Mode=TwoWay}">


https://github.com/telerik/xaml-sdk/blob/master/GridView/BindingSelectedItemsFromViewModel/MySelectedItemsBindingBehavior.cs

I was wondering if anyone can help me with this, my goal is to have each view's SelectedItems populate no matter how many instances are created. 
Minh
Top achievements
Rank 1
 asked on 24 Jul 2015
1 answer
121 views

Hi team,

As it's known to most telerik users, we can use Blend to extract the style for each Rad control. And i notice it seems to be with Office black theme. What if i want to extract the style with other themes such as Windows 8? i don't want to go through all files under Themes.Implicit\WPF40\Windows8\Themes. And one of painpoint of using the latter way is for a complex control, i need to scan the whole file to get the whole style of it. So any thoughts?

 

Yang

Sia
Telerik team
 answered on 24 Jul 2015
1 answer
131 views
I have a RadRibbonView with several RadRibbonGroup(s) and each RadRibbonGroup has its Icon property set. I am also using the Visual Studio 2013 Theme (dark). When the RadRibbonView is reduced in size, and there is not enough space to show the whole RadRibbonGroup, it will collapse and show just the Icon for the RadRibbonGroup. The background of ​the RadRibbonGroup Icon is white and it looks pretty out-of-place when using the Visual Studio 2013 dark theme or any dark theme I would assume. Should the background of the RadRibbonGroup Icon be transparent? I would assume it should look the same as a RadRibbonButton. Is there a way I can style the RadRibbonGroup so that its Icon does not show a white background?
Sia
Telerik team
 answered on 24 Jul 2015
1 answer
345 views

I am trying to define the panes for the RadDocking control using its PaneSource binding to an ObservableCollection in a ViewModel and use the SaveLayout and LoadLayout methods to persist the layout of the RadDocking control between sessions. The first question I guess I have is “Should this work?” Does the RadDockingPanesSource and the Save and Load layout methods work together? Below are the important pieces I have created trying to put this together.

 

<telerik:RadDocking x:Name=”radDocking” PanesSource=”{Binding Panes}”>
 
    <telerik:RadSplitContainer InitialPosition=”DockedLeft”>
        <telerik:RadPaneGroup x:Name=”LeftPaneGroup” />
    </telerik:RadSplitContainer >
 
    <telerik:RadSplitContainer InitialPosition=”DockedRight”>
        <telerik:RadPaneGroup x:Name=”RightPaneGroup” />
    </telerik:RadSplitContainer >
 
    <telerik:RadSplitContainer InitialPosition=”DockedBottom”>
        <telerik:RadPaneGroup x:Name=”BottomPaneGroup” />
    </telerik:RadSplitContainer >
 
    <telerik:RadDocking.DockingPanesFactory>
        <local:MyDockingPanesFactory />
    </telerik:RadDocking.DockingPanesFactory>
 
</telerik:RadDocking>

 The XAML above shows the RadDocking control in my MainWindow.xaml file.

public class MyDockingPanesFactory : DockingPanesFactory {
 
    protected override void AddPane(RadDocking radDocking, RadPane radPane) {
        RadDocking.SetSerializationTag(radPane, ((DockPaneViewModel)radPane.DataContext).SerializationTag);
 
        RadPaneGroup leftPaneGroup = radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name == “LeftPaneGroup”) as RadPaneGroup;
        if (leftPaneGroup != null) {
            if ((DockPaneViewModel)radPane.DataContext).InitialLocation == DockLocation.DockLeft) {
                leftPaneGroup.Items.Add(radPane);
            }
        }
 
        RadPaneGroup rightPaneGroup = radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name == “RightPaneGroup”) as RadPaneGroup;
        if (rightPaneGroup != null) {
            if ((DockPaneViewModel)radPane.DataContext).InitialLocation == DockLocation.DockRight) {
                rightPaneGroup.Items.Add(radPane);
            }
        }
 
 
        RadPaneGroup bottomPaneGroup = radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name == “BottomPaneGroup”) as RadPaneGroup;
        if (bottomPaneGroup != null) {
            if ((DockPaneViewModel)radPane.DataContext).InitialLocation == DockLocation.DockBottom) {
                bottomPaneGroup.Items.Add(radPane);
            }
        }
    }
 
    protected override RadPane CreateRadPaneForItem(object item) {
        if (item is DockPaneViewModel) {
            return new RadPane() {
              DataContext = item,
              Content = item
            };
        } else {
            throw new ArgumentException(“Invalid Type”);
        }
    }
 
}
 

The code above shows my DockingPaneFactory class and how is initially positions my ViewModels as RadPane(s). Notice in CreateRadPaneForItem I am setting the DataContext and the Content of the RadPane to the current DockPaneViewModel in the PanesSource. Setting the Content to the ViewModel will allow binding using a DataTemplate with a DataType defined (this is not shown). My DockPaneViewModel defines several notifiable properties like Header, IsActive, IsHidden, IsPinned, CanDockInDocumentHost, SerializationTag and defines its own InitialLocaiton that is used by the AddPane method in the DockingPaneFactory (above).

 

public abstract class DockPaneViewModel : ViewModelBase {
    //Header, IsActive, IsHidden, IsPinned, CanDockInDocumentHost, SerializationTag
}

 The code above is my DockPaneViewModel and which notifiable properties I have defined. These properties are bound their equivalent properties in the RadPane using a Style.

 

<Application … >
    <Application.Resources>
        <ResourceDictionary>
            <Style TargetType=”{x:Type telerik:RadPane}” BasedOn=”{StaticResource RadPaneStyle}”>
                <Setter Property=”Header” Value=”{Bindign Header, Mode=TwoWay}” />
                <Setter Property=”IsActive” Value=”{Bindign IsActive, Mode=TwoWay}” />
                <Setter Property=”IsHidden” Value=”{Bindign IsHidden, Mode=TwoWay}” />
                <Setter Property=”IsPinned” Value=”{Bindign IsPinned, Mode=TwoWay}” />
                <Setter Property=”CanDockInDocumentHost” Value=”{Bindign CanDockInDocumentHost, Mode=TwoWay}” />
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>

The code above shows the custom RadPaneStyle that binds the properties in my DockPaneViewModel to the RadPane. This Style is defined in the Application Resources.

private void Application_Startup(object sender, StartupEventArgs e){
    MainWindow mainWindow = new MainWindow();
    mainWindow.DataContext = new MainWindowViewModel();
    mainWindow.Show();
}

 The code above shows how I am creating and showing the MainWindow and setting its DataContext.

public class MainWindowViewModel : ViewModelBase {
 
    public ObservableCollection<DockPaneViewModel> Panes { get; private set; }
 
    public MainWindowViewModel(){
        Panes = new ObservableCollection<DockPaneViewModel>(
            new ViewModel1(),new ViewModel2(),new ViewModel3()
        );
    }
}

 The code above is my MainWindowViewModel which shows the ObservableColleciton of DockViewModels. I am just showing a hard-coded set of three ViewModels being added to the Panes collection. In the real project I am using an IOC container to create all classes that inherit from DockPaneViewModel which get added to the Panes collection.

private void RadRibbonWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
    using (System.IO.Stream stream = new System.IO.FileStream(App.LayoutSettings, System.IO.FileMode.Create)){
        this.radDocking.SaveLayout(stream);
    }
}
 
protected override void OnSourceInitialized(EventArgs e) {
    using (System.IO.Stream stream = new System.IO.FileStream(App.LayoutSettings, System.IO.FileMode.Open)) {
        this.radDocking.LoadLayout(stream);
    }
}

 Lastly the code above shows closing event and the override for the OnSourceInitialized. This is where I am saving and loading the layout XML file for the RadDocking control. The XML file that gets created does not seem to have any IsPinned properties. At first I thought I forgot to add IsPinned as a notifiable property to the DockPaneViewModel but that was not the case. I also thought I forgot to add IsPinned to the XAML Style that binds the properties between the RadPane and the DockPaneViewModel but that was not the case either.

I am not exactly sure why this is not working. I am not 100% sure if the RadDocking.PanesSource can be used with the SaveLayout and LoadLayout methods. If anyone could give me some direction or advice it would be greatly appreciated. I am not sure what to try next.

Vladi
Telerik team
 answered on 24 Jul 2015
3 answers
102 views

Hi,

we want to use the RichTextBox-Control for an CMS editor.

So we want to use it for creating and formatting texts and converting the XAML in HTML via the HtmlFormatProvider.

​My question is how I've to design a StyleDefinition so that it will be exportetd as headline tag (h1 h2, ... , h6)?

Petya
Telerik team
 answered on 24 Jul 2015
1 answer
134 views

Hi,

When IsSnapToItemsEnabled and IsSnapToGridEnabled are both true (the default setting), it's not possible to snap to the grid line right after an item line.

 

Don't know if this is intentional, but it makes it difficult to move everything by 1 grid line when all the nodes are spaced with 2 grid lines in between.. See screenshot to see what I mean.

 

Regards,

Bayram

Milena
Telerik team
 answered on 24 Jul 2015
1 answer
115 views
Hi!

Is there a way to filter item's of the complex type in RadDataFilter?

I know that fIlter works fine with simple entity classes like that:
public enum MyEnum {A, B, C};
 
public class ClassA
{
    public string Name { get; set; }
    public int Count { get; set; }
    public MyEnum Type { get ;set; }
}

So I can request from a database some filtered data like that:
var filters = new CompositeFilterDescriptorCollection();
filters.AddRange(MyRadDataFilter.FilterDescriptors);
filters.LogicalOperator = MyRadDataFilter.LogicalOperator;
 
using (var context = new DbContext())
{
    var result = context.Set<ClassA>().Where(filters);
    var data = result as  IEnumerable<ClassA>;
    return data.ToList();
}

And it returns me the data that matches my filter. For example, all ClassA items, where Count > 5.

But I can't find out a way to do that with complex types. Here is one example:
public class AddressClass
{
    public string Country { get; set; }
    public string City { get; set; }
}
 
public enum GenderEnum { Male, Female };
 
public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
    public GenderEnum Gender { get; set; }
}
 
public class Doc
{
    public DateTime Date { get; set; }
    public string Content { get; set; }
    public AddressClass Address { get; set; }
    public List<Person> Persons { get; set; }
}

So I have to load Doc's that mathes some filter like that : 
All docs, where Address.City is NewYork
or
    All docs in which there is a person older than 22 years.
And so I need to give users the ability to set the conditions in the filter.

How could I do?

I would be glad to get a working example project.
Hope to hear from you soon.
Thanks.

Stefan
Telerik team
 answered on 24 Jul 2015
7 answers
358 views
Hi,

Is there any way to change the background color of modal RadWindow to make them looks like the standard ChildWindow that exists in Silverlight ?

After looking for that info on the forums, it seems it's possible in Silverlight and WPF (XBAP) but not in "normal" WPF....

Any ideas on how to fix this ? Any workaround ?

Thanks !
Kalin
Telerik team
 answered on 24 Jul 2015
0 answers
153 views

Hello,

I have Multiple  ​Format String for columns. I want to binding Multiple  ​DataFormatString for columns. But it doesn't work. 

My source:

View 

<telerik:RadGridView Name="GridWatchPriceTable"  ItemsSource="{Binding ModelData.LstFeeTable}" Style="{DynamicResource GridViewCustomStyle}" 
                                 IsReadOnly="False" >

<telerik:RadGridView.Columns>

   <telerik:GridViewDataColumn DataMemberBinding="{Binding HighPrice}" 
                                                 DataFormatString="{Binding NumberDecimalString}"                                                
                                                Header="{StaticResource ListFeeTable_High}" TextAlignment="Right" IsReadOnly="True"/>

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

 

In ViewModel, I Set value for item in LstFeeTable

  private ListPriceTableInfoModel UpdateDataModel(Symbol item, ListPriceTableInfoModel model)
        {
            model.SymbolId = item.SymbolId;
            model.SymbolName = item.ContractName;

            var baseSymbolInfo = Operator.Instance.GetBaseSymbolById(item.BaseSymbolId);
            if (baseSymbolInfo != null)
            {
                model.FullName = baseSymbolInfo.FullName;
                model.ShortName = baseSymbolInfo.ShortName;
                model.BaseSymbolId = baseSymbolInfo.BaseSymbolId;
                model.NumberDecimal = baseSymbolInfo.NumbreDecimal;
                model.NumberDecimalString = ClientUtils.GetFormatString(baseSymbolInfo,true);
                var exchange = Operator.Instance.GetExchangeInfoById(baseSymbolInfo.ExchangeId);
                model.Exchange = exchange != null ? exchange.ShortName : "";
            }

            model.ClosePrice = (decimal)100.6654;
            model.OpenPrice = (decimal)100.6654;
            model.HighPrice = (decimal)100.6654;
            model.LowPrice = (decimal)100.6654;
            model.YesterdayClose = (decimal)100.6654;
            model.YesterdaySettlement = (decimal)100.6654;
            model.TotalVolume = null;
            model.NetChg = (decimal)100.6654;
            model.NetChgPercent = (decimal)100.6654;
            model.VolBid = null;
            model.Ask = (decimal)100.6654;
            model.VolAsk = null;
            model.VolAskOld = null;
            model.VolBidOld = null;
            model.BidOld = (decimal)100.6654;
            model.VolBidOld = null;
            model.ClosePriceOld = (decimal)100.6654;
            model.LastTrade = (decimal)100.6654;
            model.LastTradeOld = (decimal)100.6654;
            model.Bid = (decimal)100.6654;
            model.BidOld = (decimal)100.6654;
            return model;
        }​

 

I set property NumberDecimalString  with function GetFormatString but it doesn't work.  Please Help me

Thank for watching!

    

 

ShinichiKudo
Top achievements
Rank 1
 asked on 24 Jul 2015
3 answers
154 views

Dear Support,
I'm very new with Telerik and I'm evaluating WPF Diagram in a new project for one of our most important customer.

One of Custom Shape we have to build must implement the function to add Connectors (for example by a Context Menu acttivated command).

The Shape has a linear aspect and adding commands are "Add connector on the Right" and "Add connector on the Left".

Both adding methods recalculate Offset of exixsting connectors and then add a new connector, with the aim to have connectors regularly spaced along the Shape.

Although I can see new connector and existing ones in the Shape Connectors List, the aspect of the rendered Shape does not change that is to say that I cannot see the new connector and exixsting ones do not change their position.

Those commands ​must operate (change Offset) also on Connectors with Connections, so for now I discarded the way of Remove and Add Connectors in order to avoid to loose existing Connection.

Where's my error?

Thank you

King Regards

 

Domenico

Petar Mladenov
Telerik team
 answered on 24 Jul 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?